#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
int main() {
int n, q;
scanf( "%d%d" ,&n, &m );
int num[maxn] = {INT_MAX};
for ( int i = 1; i <= n; i ++ ) {
scanf("%d",&num[i]);
}
while ( m -- ) {
int pos = -1, target;
scanf( "%d" ,&target );
int l = 1, r = n;
while ( l < r ) {
int mid = l + ( ( r - l ) >> 1 );
if ( num[mid] == target ) {
pos = mid;
break;
} else if ( num[mid] < target ) {
l = mid + 1;
} else {
r = mid - 1;
}
}
while ( num[pos - 1] == num[pos] )
pos --;
printf("%d ",pos);
}
return 0;
}