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

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;
  }
  return -1;
}

int nadjib(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 + 1;
    if(data[d] < target) return d + 1;
  }
  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];

  int x;
  for(int i = 0; i < q; i++){
    if(nadji(b[i], a, 0, n) != -1) {
        x = nadji(b[i], a, 0, n) + 1;
        if(b[i] == a[n / 2] ) cout << 0 << endl;
        else if(x % 2 == 0) {
            if((x - 1) * 2 - n < 0) cout << abs((x - 1) * 2 - n + 1)<< endl;
            else cout << (x - 1) * 2 - n<< endl;     
        }
        else cout << abs((x - 1) * 2 - n + 1)<< endl;
    }
    else if(b[i] < a[0]) cout << n;
    else {
        x = nadjib(b[i], a, 0, n) + 1;
        n++;
        if(x == n / 2 + 1) cout << 1 << endl;
        else if(n % 2 == 0) cout << abs(x - 1 - ((n + 1) - x) + 1)<< endl;
            else if(x - 1 - ((n + 1) - x) < 0) cout << abs(x - 1 - ((n + 1) - x) + 1)<< endl;   
                else cout << x - 1 - ((n + 1) - x)<< endl;
        n--;
    }
  }
  
  
}