//新生训练
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int a[N],b[N],n,m;
int upper_bound(int*arr,int x){
int l=0,r=n-1;
while(l<r){
int mid=(l+r)/2;
if(arr[mid]>x) r=mid;
else if(arr[mid]<=x) l=mid+1;
}
if(a[l]>x) return a[l];
return -1;
}
int main(){
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for(int i=0; i<n; i++) cin >> a[i];
for(int i=0; i<m; i++) cin >> b[i];
sort(a, a+n);
for(int i=0; i<m; i++){
cout << upper_bound(a,b[i]) << endl;
}
return 0;
}
//因为不能等于,所以用upper_bound;
~~~//仅当笔者个人备忘录使用。