#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int m,n;
cin>>m>>n;
int *a=new int[m+1];
int *b=new int[n];
for(int i=1; i<=m; i++)
cin>>a[i];
for(int i=0; i<n; i++)
cin>>b[i];
for(int i=0; i<n;i++) {
int ans=lower_bound(a+1,a+1+m,b[i])-a;
if(a[ans]!=b[i])
cout<<-1;
else cout<<ans;
if(i!=n-1)
cout<<ends;
}
delete[] a;
delete[] b;
return 0;
}