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

int check(int pos, int n, int x, bool add_left)
{
	if (add_left)
	{
		return pos + x == floor((n + x) * 0.5);
	}
	else
	{
		return pos == floor((n + x) * 0.5);
	}
}

int main()
{
	int n, t;
	cin >> n >> t;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	
	sort(a.begin(), a.end());
	while (t--)
	{
		int q; cin >> q;
		auto lb = lower_bound(a.begin(), a.end(), q);
		auto ub = upper_bound(a.begin(), a.end(), q);
		int l = lb - a.begin();
		int r = ub - a.begin();
		int add1 = 0;
		if (l < n && a[l] == q)
		{
			r--;
		}
		else
		{
			add1 = 1;
		}
		int size = n + add1;
		int x;
		int median_pos = floor(size * 0.5);
		int closest_to_median = -1;
		bool add_left = false;
		if (l <= median_pos && median_pos <= r)
		{
			x = add1;
			cout << x << endl;
			continue;
		}
		else if (r < median_pos)
		{
			closest_to_median = r;
			add_left = true;
		}
		else if (l > median_pos)
		{
			closest_to_median = l;
		}

		int offset;
		int cnt_right = size - closest_to_median - 1;
		int cnt_left = closest_to_median;
		int dist = abs(cnt_left - cnt_right);
		for (offset = -2; offset <= 2; offset++)
		{
			if (check(closest_to_median, size, max(dist + offset, 0), add_left)) break;
		}

		cout << dist + offset + add1 << endl;
	}
}