#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int br(vector<int>a, int b)
{
	bool ima = false;
	int i;
	int ccc=0;
	int p=0;
	bool paran = false;
	if (a.size() % 2 == 0)
		paran = true;
	for (i = 0; i < a.size(); i++)
	{
		if (a[i] == b)
		{
			ima = true;
			p = i;
		}
	}
	if (ima == false)
	{
		a.push_back(b);
		ccc++;
		sort(a.begin(), a.end());
		for (i = 0; i < a.size(); i++)
		{
			if (a[i] == b)
			{
				p = i+1;
			}
		}
	}
	p++;
	if (p == a.size() / 2+1)
		return 0;
	if (paran)
	{
		if (p < a.size() / 2)
			ccc = (a.size() / 2 - p)*2-1;
		else
			ccc = (p - a.size() / 2)*2;
	}
	else
	{
		if (p < a.size() / 2 )
			ccc = (a.size() / 2 +1- p) * 2;
		else
			ccc = (p - a.size() / 2-1) * 2 -1;
	}

	return ccc ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m;
	cin >> n >> m;
	int i,j;
	int k;
	vector <int>a;

	for (i = 0; i < n; i++)
	{
		cin >> k;
		a.push_back(k);
	}
	sort(a.begin(), a.end());
	for (i = 0; i < m; i++)
	{
		cin >> k;
		
		cout << br(a, k)<<endl;
	}
	
	
	
}