#include <iostream>
using namespace std;
long long n,k,a[100010],d,lefa,righa,middle;
int main(){
cin>>n>>k;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<k;i++){
righa=n;
lefa=0;
int x;
cin>>x;
while(lefa+1<righa)
{
middle=(lefa+righa)/2;
if(a[middle]<=x){
lefa=middle;
}
else
{
righa=middle;
}
}
if(a[lefa]==x){
cout<<lefa+1<<"\n";
}else{
cout<<"0\n";
}
}
return 0;
}