#include <stdlib.h>
#include <malloc.h>
#include <iostream>
#include <algorithm>
using namespace std;



int bS(int a[], int l, int r, int x)
{
	int mid = l + (r - l) / 2;

	if (r >= l) 
	{
		if (a[mid] == x)
			return mid;

		if (a[mid] > x)
			return bS(a, l, mid - 1, x);

		return bS(a, mid + 1, r, x);
	}

	return -mid;
}

int bSL(int a[], int l, int r, int x)
{
	int mid = l + (r - l) / 2;
	//cout << mid << "\n";
	if (r > l) 
	{
		if (a[mid] == x)
		{
			bSL(a, mid + 1, r, x);
			
		}
		else 
		{ 
			bSL(a, l, mid - 1, x);
			
		}
	}
	return mid;
}

int bSR(int a[], int l, int r, int x)
{
	int mid = l + (r - l) / 2;

	if (r > l)
	{
		if (a[mid] == x) bSL(a, l, mid-1, x);
		else bSL(a, mid+1, r, x);
	}
	
	return mid;
}


int a[200000];
int b[200000];

int main()
{
	int n, q, x, m;
	cin >> n >> 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);

	for(int i = 0; i < q; i++)
	{
		m = 0;
		int x = bS(a, 0, n - 1, b[i]);
		
		//cout << x << "\n";
		if (x < 0) 
		{
			m += 1;
			x *= -1;



			if (x == n / 2)
			{
				if (n % 2 != 0)
					m += 1;
			}
			else if (x < n / 2)
			{
				if (n % 2 == 0)
					m += ((n + 1) / 2 - x) * 2;
				else m += ((n + 1) / 2 - x) * 2 - 1;
			}
			else 
			{
				if (n % 2 == 0)
					m += (x - (n + 1) / 2) * 2 - 1;
				else m += (x - (n + 1) / 2) * 2;

			}
			
		}
		else
		{
			if (x < n / 2)
			{
				int xl = bSL(a, x, n / 2, b[i]);
				
				while (a[xl] != b[i])
					xl -= 1;
				//cout << xl;
				if (n % 2 == 0)
					m += (n / 2 - xl) * 2 - 1;
				else m += (n / 2 - xl) * 2;
			}
			else if (x > n / 2)
			{
				int xr = bSR(a, n / 2, x, b[i]);
				while (a[xr] != b[i])
					xr += 1;
				//cout << xr;
				if (n % 2 == 0)
					m += (xr - n / 2) * 2;
				else m += (xr - n / 2) * 2 - 1;
			}
		}
		cout << m<<"\n";
	}

	
	
}