#include <iostream>
#include <bits/stdc++.h>
using namespace std;
long long _num[1000001] = {0};
long long _ans[1000001] = {0};
long long _res = 0;
long long giao = 0;
long long ans = 0;
void ParseIn () {
cin >> _res;
cin >> giao;
for (int i = 1; i <= _res; i++) {
cin >> _num[i];
}
sort (_num , _num + _res + 1);
for (int i = 1; i <= giao; i++) {
cin >> _ans[i];
}
}
int find (long long n, long long s[] , long long x) {
long long low = 0;
long long hight = _res;
long long middle;
while (low <= hight) {
middle = (low + hight) / 2;
if (x == s[middle]) {
return middle;
} else if (x < s[middle]) {
hight = middle - 1;
} else {
low = middle + 1;
}
}
return -1;
}
void Core () {
long long curInt = 1;
long long curInt2 = 0;
for (int i = 1; i <= giao; i++) {
ans = 0;
curInt2 = _ans[curInt];
ans = find(_res,_num,curInt2);
if (ans > -1) {
cout << ans << " ";
}
else {
cout << "-1";
}
curInt++;
}
}
void CWriteOut () {
}
int main () {
ParseIn();
Core();
CWriteOut();
return 0;
}