#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, m;
int a[N];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for(int i =1 ;i <= n;i++)cin >> a[i];
while(m--)
{
int x;
cin >> x;
int l = 1, r = n;
while(l < r)
{
int mid = (l + r) >> 1;
if(a[mid] >= x)r = mid;
else l = mid + 1;
}
// cout << l << " ";
if(a[l] == x)cout << l << " ";
else cout << "-1 ";
}
return 0;
}