#include <bits/stdc++.h>
using namespace std;

long long n,q,a[100005],b[100005],m;

int main(){
  cin >> n >> q;

  for(int i = 1; i <= n; i++){
    cin >> a[i];
  }
  sort(a+1,a+n+1);

  if(n%2 == 0){
    m = a[n/2+1];
  }
  else{
    m = a[(n-1)/2+1];
  }

  for(int i = 1; i <= q; i++){
    cin >> b[i];
    if(b[i] == m){
      cout << 0 << endl;
    }
    else if(b[i] > a[n]){
      cout << n << endl;
    }
    else if(b[i] < a[1]){
      cout << n+1 << endl;
    }
  }

  return 0;
}