#include<bits/stdc++.h>
using namespace std;
int n,m,a[100001],b[100001];
int find(int begin,int end,int d){
if(begin>end) return -1;
int mid=(begin+end)/2;
int ret=-1;
if(a[mid]==d) return ret=mid;
else if(a[mid]>d){
ret=find(begin,mid-1,d);
}else{
ret=find(mid+1,end,d);
}
return ret;
}
int main(){
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<m;i++){
cin>>b[i];
cout<<find(0,n-1,b[i])<<endl;
}
return 0;
}