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

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n, q;
    cin >> n >> q;
    vector<int> vec(n+1);
    for(int i = 1; i <= n; i++) {
    	cin >> vec[i];
    }
    sort(vec.begin(), vec.end());

    for(int i = 0; i < q; i++){
    	int N = n;
    	int x;
    	cin >> x;
    	int l = 1, r = n;
    	if(x < vec[1] || x > vec[n]) {
    		cout << n << endl;
    		continue;
    	}

    	int lg = 0;
    	while(l <= r) {
    		int mid = (l + r) / 2;
    		if(vec[mid] < x) {
    			lg = mid;
    			l = mid + 1;
    		} 
    		else 
    		{
    			r = mid - 1;
    		}
    	}
    	l = 1, r = n;
    	int dg = n + 1;
    	while(l <= r) {
    		int mid = (l + r) / 2;
    		if(vec[mid] > x) {
    			dg = mid;
    			r = mid - 1;
    		} 
    		else 
    		{
    			l = mid + 1;
    		}
    	}


    	if(lg + 1 == dg) {
    		N++;
    		dg++;
    	}	


    	int mid = floor(N / 2.0f) + 1;
    	int ans = 0;
//cout << lg << " " << dg << endl;
//cout << mid << endl;
    	int t;
    	if(mid > lg && mid < dg) ans = 0;
    	else if (mid <= lg) {
    		t = dg - 1;
    		ans = 2 * t - N - 2;
    	}
    	else if (mid >= dg) {
    		t = lg + 1;
    		ans = N - 2 * t + 2 - 1;
    	}
    	else cout <<  "wtf" << endl;

    	cout << ans << endl;
    }
    
    return 0;
}