#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int nadji(int target, vector<int>& data, int l, int d){
    while(d - l >= 2){
  int m = (l + d) / 2;
  if(data[m] >= target) d = m;
    else l = m;
  }
  if(d - l < 2){
    if(data[l] <= target) return l;
    if(data[d] <= target) return d;
    if(data[l] < target) return l;
    if(data[d] < target) return d;
  }
  return -1;
}

int main() {
  int n, q;
  cin >> n >> q;
  vector<int> a(n), b(q), rez(q), p(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  for(int i = 0; i < q; i++) cin >> b[i];
  
  for(int i = 0; i < q; i++){
    cout << nadji(b[i], a, 0, n);
  }
  
  
}