#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
bool find(int a[], int n, int b)
{
	for (int i=0; i<n; i++)
	{
		if (a[i]==b)
		{
			return true;
		}
	}
	return false;
}
int distance(int a[], int n, int b)
{
	for (int i=0; i<n; i++)
	{
		if (a[i]==b)
		{
			return i;
		}
	}
}
int main()
{
	int n, q;
	cin>>n>>q;
	int a[n];
	for (int i=0; i<n; i++)
	{
		cin>>a[i];
	}
	int b[q];
	for (int i=0; i<q; i++)
	{
		cin>>b[i];
	}
	int s[q];
	int k;
	int x[n+1];
	sort(a, a+n);
	for (int i=0; i<q; i++)
	{
		if (find(a, n, b[i])==true)
		{
			k=distance(a, n, b[i])+1;
			if (k==(n/2)+1)
			{
				s[i]=0;
				cout<<s[i]<<endl;
				continue;
			}
			if (k>(n/2)+1)
			{
				s[i]=((k-1)*2)-n;
			}
			else
			{
				s[i]=(n/2+1)-k;
				while (k+s[i]<((n+s[i])/2)+1)
				{
					s[i]++;
				}
			}
		}
		else
		{
			for (int j=0; j<n; j++)
			{
				x[j]=a[j];
			}
			x[n]=b[i];
			sort(x, x+n+1);
			k=distance(x, n+1, b[i])+1;
			if (k==(n/2)+1)
			{
				s[i]=1;
				cout<<s[i]<<endl;
				continue;
			}
			if (k>(n/2)+1)
			{
				s[i]=((k-1)*2)-n;
			}
			else
			{
				s[i]+=(n/2+1)-k;
				while (k+s[i]<((n+s[i])/2)+1)
				{
					s[i]++;
				}
			}
		}
		cout<<s[i]<<endl;
	}
}