#include <bits/stdc++.h>
using namespace std;
int a[1000005];
void check(int l, int r, int key) {
int p = (l + r) / 2;
int flag = a[p];
if (l > r) {
cout << -1 << " ";
} else if (flag == key) {
while (a[p] == key) {
p--;
}
cout << p + 2 << " ";
} else if (key < flag) {
check(l, p - 1, key);
} else {
check(p + 1, r, key);
}
}
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
int j;
cin >> j;
check(0, n - 1, j);
}
return 0;
}