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

int najblizi_centru(int*& niz, int len, int el)
{
	int index = -1;
	for (int i = 0; i < (len/2) + len%2; i++)
	{
		if (niz[i] == el)
			index = i;
		if (niz[len - i - 1] == el)
			index = len - i - 1;
	}
	return index;
}

int main()
{
	int n, q;
	cin >> n;
	cin >> q;

	int* A = new int[n];
	int* B = new int[q];

	for (int i = 0; i < n; i++) cin >> A[i];
	for (int i = 0; i < q; i++) cin >> B[i];

	sort(A, A+n);

	int med = n / 2;

	for (int i = 0; i < q; i++)
	{
		int test = B[i];
		int index = najblizi_centru(A, n, B[i]);

		if (index == -1)
		{
			int izm = -1;
			for (int j = 0; j < n; j++)
			{
				if (A[j] > B[i])
				{
					izm = i;
					break;
				}
			}
			if (izm == -1) cout << n << endl;
			else if (izm == 0) cout << n + 1 << endl;
			else if (izm - n % 2 == med) cout << 1 << endl;
			else if (izm - n % 2 > med) cout << izm - 1 << endl;
			else if (izm - n % 2 < med) cout << izm + 2 << endl;
		}
		else if (index == med) cout << 0 << endl;
		else if (index > med) cout << index - (n - index - 1) - 1 << endl;
		else if (index < med) cout << (n - index - 1) - index << endl;
	}
}