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

void prv(vector<int> a) {
	for (int x : a) cout << x << " ";
	cout << endl;
}

int solve(vector<int> a, int t) {
	int med = a.size()/2;
	if (a[med] == t) {
		return 0;
	}
	int ind = lower_bound(a.begin(), a.end(), t) - a.begin();
	int n = 0;
	if (ind >= a.size() || a[ind] != t) {
		a.insert(a.begin()+ind,t);
		n++;
		med = a.size() / 2;
	}
	if (a[med] == t) return 1;
	float mid = a.size() / 2.0;
	float diff = abs(mid - ind);
	if (a[med] < t) 
		return (int)(diff * 2) + n;
	else 
		return (int)(diff * 2) + 1 + n;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	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;
	}
}