#include<bits/stdc++.h>
using namespace std;
int main (){
int n,m,a[1000005];
cin>>n>>m;
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
}
for(int i=1;i<=m;i++){
int s;
scanf("%d",&s);
int l=1,r=n,ans=-1;
while(l<=r){
int mid=(l+r)/2;
if(a[mid]>=s){
if(a[mid]==s)ans=mid;
r=mid-1;
}else l=mid+1;
}
printf("%d ",ans);
}
return 0;
}