#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

void bin(vector<int> a, int x, int &poz, int &d){
	int l = 0, s;
	d = a.size() - 1;
	poz = -1;
	
	while(l <= d){
		s = l + (d-l) / 2;
		if(x == a[s]){
			poz = s;
			break;
		}
		else if(x < a[s])
			d = s - 1;
		else
			l = s + 1;
	}
}

int main(){
	int n, q, x;
	cin >> n >> q;
	
	vector<int> a;
	
	for(int i = 0; i < n; i++){
		cin >> x;
		a.push_back(x);
	}
	
	sort(a.begin(), a.end());
	
	for(int i = 0; i < q; i++){
		cin >> x;
		if(x > a[a.size()-1])
			cout << n << endl;
		else if(x < a[0])
			cout << n+1 << endl;
		else{
			int poz, d, medijana = n/2;
			bin(a, x, poz, d);
			if(poz != -1){
				if(poz == medijana)
					cout << 0 << endl;
				else if(poz < medijana)
					cout << (n - 2*poz - 1) << endl;
				else
					cout << (2*poz - n) << endl;
			}	
			else{
				if(d < medijana)
					cout << (n - 2 * d - 1) << endl;
				else
					cout << (2*d - n + 2) << endl;
			}
		}
	}

}