#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n, q;
	cin >> n >> q;
	int a[n], b[q];
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int z;
	for(int i = 0; i < n-1; i++)
	{
		for(int j = 0; j < n-1; j++)
		{
			if(a[j]>a[j+1])
			{
				z=a[j];
				a[j]=a[j+1];
				a[j+1]=z;
			}
		}
	}
	int m = a[n/2];
	for(int i = 0; i < q; i++)
	{
		cin >> b[i];
	}
	int c = 0;
	for(int i = 0; i < q; i++)
	{
		c=0;
		if(b[i]==m)
		{
			cout << '0' << endl;
		}
		else if(b[i]>m)
		{
			for(int j = n/2; j < n; j++)
			{
				if(b[i]>a[j])
				{
					c++;
				}
				if(b[i]<a[j])
				{
					cout << c << endl;
				}
				else if(j==n-1)
				{
					c = 2*c-1;
					cout << c << endl;
				}
			}
		}
		else
		{
			for(int j = n/2+1; j > -1; j--)
			{
				if(b[i]<a[j])
				{
					c++;
				}
				if(b[i]>=a[j])
				{
					cout << c << endl;
				}
				else if(j == 0)
				{
					c = 2*c-1;	
					cout << c << endl;
				}
			}
		}
	}
	return 0;
}