#include <iostream>
using namespace std;
const int maxn=1e6+50;
typedef long long ll;
ll n,m,a[maxn];
ll erfen(ll l,ll r,ll x){
while(l<r){
int mid=(l+r)>>1;
if(x==a[mid]&&a[mid]!=a[mid-1]){
if(mid<1||mid>n)return -1;
else return mid;
}
if(x<=a[mid]){
r=mid;
}else l=mid+1;
}
return -1;
}
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++)cin>>a[i];
while(m--){
int x;
cin>>x;
cout<<erfen(1,n,x)<<" ";
}
return 0;
}