#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int n, m, f[2800000] = {}, q[2800000];
int main()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
int t;
cin >> t;
if (t < 0)
t += 1200000;
f[t] = 1;
q[t] = i;
}
for (int i = 1; i <= m; i++)
{
int t;
cin >> t;
if (t < 0)
t += 1200000;
if (f[t])
cout << q[t] << endl;
else
cout << -1 << endl;
}
return 0;
}