#include <bits/stdc++.h>
using namespace std;
int arr [1000100];
int bs(int start,int end,int key){
int ret=-1;
int mid;
while(start<=end){
mid=start+((end-start)>>1);
if(arr[mid]<key){
start=mid+1;
}else if(arr[mid]>key){
end=mid-1;
}else{
ret=mid;
break;
}
}
return ret;
}
int main(){
int n,m;
std::ios::sync_with_stdio(false);
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<m;i++){
int x;
cin>>x;
int half=bs(0,n,x);
int minx=half;
if(half!=-1){
for(int j=half;j>=0;j--){
if(arr[j]!=x){
break;
}else{
minx--;
}
}
cout<<minx+2<<" ";
}else{
cout<<"-1 ";
}
}
return 0;
}
80 pts