#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    int a[n];
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    while(q--) {
    	int x;
    	cin >> x;
    	if(a[n / 2] == x) {
    		cout << "0\n";
    		continue;
    	}
    	if(a[0] > x) {
    		cout << n + 1 << "\n";
    		continue;
    	}
    	if(a[n - 1] < x) {
    		cout << n << "\n";
    		continue;
    	}
    	int l = 0, r = n - 1;
    	int L = r;
    	while(l <= r) {
    		int mid = (l + r) >> 1;
    		if(a[mid] >= x) {
    			L = mid;
    			r = mid - 1;
    		} else l = mid + 1;
    	}
    	l = 0;
    	r = n - 1;
    	int R = l;
    	while(l <= r) {
    		int mid = (l + r) >> 1;
    		if(a[mid] <= x) {
    			R = mid;
    			l = mid + 1;
    		} else r = mid - 1;
    	}
    	int res = 0;
    	if(L > R) res++;
    	int left = L, right = n - R - 1;
    	int mid = max(1, n - left - right);
    	if(left > mid + right) res += left - mid - right;
    	else if(right >= mid + left) res += right - mid - left + 1;
    	cout << res << "\n";
    }
    return 0;
}