#include<bits/stdc++.h>
using namespace std;
long long n,m;
struct xxx
{
int wei;
bool b;
long long shu;
}a[100000005];
int main()
{
scanf("%lld%lld",&n,&m);
cin>>a[1].shu;
a[1].wei=1;
a[1].b=1;
for(int i=2;i<=n;i++)
{
cin>>a[i].shu;
if(a[i].shu==a[i-1].shu) a[i].wei=a[i-1].wei;
else a[i].wei=i;
a[a[i].shu].b=1;
}
for(int i=1;i<=m;i++)
{
long long x;
scanf("%lld",&x);
if(a[x].b==0)
{
cout<<-1<<' ';
continue;
}
long long l=1,r=n;
while(l<=r)
{
int mid=(l+r)/2;
if(a[mid].shu==x)
{
printf("%lld ",a[mid].wei);
break;
}
else if(a[mid].shu>x) r=mid-1;
else l=mid+1;
}
}
return 0;
}