#include<iostream>
using namespace std;
const int MAXN = 1e6 + 10;
int read()
{
int x = 0, p = 1;
char c = getchar();
while (c < '0' || c>'9')
{
if (c == '-')p = -1;
c = getchar();
}
while (c >= '0' && c <= '9')
{
x = x * 10 + c - '0';
c = getchar();
}
return x * p;
}
int towfind(int* a, int i, int o)
{
int s = 1;
while (s <= o)
{
int k = (s + o) / 2;
if (a[k] == i)
{
if (a[k - 1] == i)
{
o = k - 1;
continue;
}
return k;
}
else if (a[k] > i)
{
o = k - 1;
}
else if (a[k] < i)
{
s = k + 1;
}
}
return -1;
}
int main()
{
int n = read(), m = read(), a[MAXN], c;
for (int i = 1; i <= n; i++)
{
a[i] = read();
}
while (m--)
{
c = read();
cout << towfind(a, c, n) << " ";
}
return 0;
}