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

vector <int> A;
vector <int> B;

int Index(vector<int> v, int K)
{
	auto it = find(v.begin(), v.end(), K);
	if (it != v.end()){
		int index = it - v.begin();
		return index;
	}
	else return -1;
}

int f(int i, int N, int Q)
{
	int x = Index(A, B[i]);
	bool b = false;
	if (x == -1) {
		A.push_back(B[i]);
		sort(A.begin(), A.end());
		N++;
		b = true;
	}

	if (A[N / 2] == B[i])
		return 1;
	else if (A[N / 2] > B[i])
	{
		for (int j = N / 2 - 1; j >= 0; j--)
		{
			if (A[j] == B[i])
			{
				x = j;
				break;
			}
		}
		if (b) N--;
		return (N - 1) - 2 * x;
	}
	else
	{
		for (int j = N / 2 + 1; j < N; j++)
		{
			if (A[j] == B[i])
			{
				x = j;
				break;
			}
		}
		if (b) N--;
		return 2 * x - N;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int N, Q, a, x;
	cin >> N >> Q;
	for (int i = 0; i < N; i++){
		cin >> a;
		A.push_back(a);
	}
	for (int i = 0; i < Q; i++) {
		cin >> a;
		B.push_back(a);
	}
	sort(A.begin(), A.end());

	vector <int> A1 = A;

	for (int i = 0; i < Q; i++)
	{
		A = A1;
		if (A[N / 2] == B[i])
			cout << "0" << "\n";
		else
		cout << f(i, N, Q) << "\n";
	}
}