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

int solve(vector<int> a, int t) {
	int med = a.size()/2;
	if (a[med] == t) {
		return 0;
	}
	bool exists = binary_search(a.begin(), a.end(), t);
	int n = 0;
	if (!exists) {
		a.push_back(t);
		n++;
		sort(a.begin(), a.end());
		med = a.size() / 2;
	}
	if (a[med] == t) return 1;
	int index = -1;
	for(int i = 0; i < a.size(); i++) 
		if (a[i] == t) {
			index = i;
			break;
		}
	float mid = a.size() / 2.0;
	float diff = abs(mid - index);
	if (a[med] < t) 
		return (int)(diff * 2) + n;
	else 
		return (int)(diff * 2) + 1 + n;
}

int main() {
	int n, q;
	cin >> n >> q;
	vector<int> a(n);
	for (int i = 0; i < n; i++) 
		cin >> a[i];
	sort(a.begin(), a.end());
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		cout<<solve(a, t)<<endl;
	}
}