War_GodO_oBrother @ 2022-05-29 14:37:16
#includebitsstdc++.h
using namespace std;
const int N=1000005;
struct node
{
int x,idd;
}a[N];
int main()
{
int i,n,k,m,y,q;
scanf(%d%d,&n,&m);
a[0].x=0;
k=1;
for(i=1;i=n;i++)
{
scanf(%d,&y);
if(y!=a[k-1].x)
{
a[k].x=y;
a[k++].idd=i;
}
}
int l,r,mid;
while(m--)
{
scanf(%d,&q);
l=1,r=k-1;
while(l=r)
{
mid=(l+r)2;
if(a[mid].x==q) break;
if(a[mid].xq) r=mid-1;
else l=mid+1;
}
if(lr) printf(-1 );
else printf(%d ,a[mid].idd);
}
}