#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void swap(int* x, int* y)
{
	int t = *x;
	*x = *y;
	*y = t;
}

void sort(int* arr, int n)
{
	int i, j;
	for(i = 0; i < n - 1; i++)
		for(j = 0; j < n - i - 1; j++)
			if(arr[j] > arr[j + 1])
				swap(&arr[j], &arr[j + 1]);
}

int find(int* arr, int n, int x)
{
	int ind = -1, i;
	for(i = 0; i < n; i++)
		if(arr[i] == x)
			ind = i;
	
	return ind;
}

int main(void)
{
	int	N = 0,
					Q = 0,
					med = 0,
					medi = 0,
					i = 0,
					granica = 0,
					ind = 0;
	
	int* A = NULL;
	int* B = NULL;
	
	scanf("%d %d", &N, &Q);
	A = malloc(N * sizeof(int));
	for(int i = 0; i < N; i++)
		scanf("%d", &A[i]);
	
	B = malloc(Q * sizeof(int));
	for(int i = 0; i < Q; i++)
		scanf("%d", &B[i]);
	
	sort(A, N);
	
	medi = N / 2;
	med = A[medi];
	
	for(i = 0; i < Q; i++)
	{
		granica = B[i];
		if(granica == med)
		{
			printf("0\n");
			continue;
		}
		if(granica > med)
		{
			ind = find(A, N, granica);
			if(ind == -1)
			{
				if(granica > A[N - 1])
					printf("%d\n", N);
				else
					printf("%d\n", granica - med);
			}
			else
				printf("%d\n", (ind * 2) - N);
			
			continue;
		}
		if(granica < med)
		{
			ind = find(A, N, granica);
			if(ind == -1)
				if(granica < A[0])
					printf("%d\n", N + 1);
				else
					printf("%d\n", N - granica / 2);
			else
				printf("%d\n", med - granica);
			continue;
		}
	}
	
	free(A);
	free(B);
	
	return 0;
}