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

void deli(int a[], int l, int m, int r)
{
	int i, j, k;
	int n1 = m - l + 1;
	int n2 = r - m;
	int L[n1], R[n2];
	for (i = 0; i < n1; i++)
		L[i] = a[l + i];
	for (j = 0; j < n2; j++)
		R[j] = a[m + 1 + j];
	i = 0;
	j = 0;
	k = l;
	while (i < n1 && j < n2) {
		if (L[i] <= R[j]) {
			a[k] = L[i];
			i++;
		}
		else {
			a[k] = R[j];
			j++;
		}
		k++;
	}
	while (i < n1) {
		a[k] = L[i];
		i++;
		k++;
	}
	while (j < n2) {
		a[k] = R[j];
		j++;
		k++;
	}
}

void sort(int a[], int l, int r){
	if (l < r) {
		int m = l + (r - l) / 2;
		sort(a, l, m);
		sort(a, m + 1, r);
		deli(a, l, m, r);
	}
}

int bin(int a[], int l, int r, int x)
{
    if (r >= l) {
        int m = l + (r - l) / 2;
        if (a[m] == x)
            return m;
        if (a[m] > x)
            return bin(a, l, m - 1, x);
        return bin(a, m + 1, r, x);
    }
    return -1;
}

int main()
{
	int i, j, med, ind, x;
	int n, q;
	scanf("%d %d", &n, &q);
	int a[n], b[q];

	for(i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	for(i=0;i<q;i++){
		scanf("%d", &b[i]);
	}
	sort(a, 0, n - 1);
	
	for(i=0;i<q;i++){
		int k = 0;
		ind = bin(a, 0, n - 1, b[i]);
		if(ind == -1){
			printf("%d\n", n);
			continue;
		}
		med = a[n/2];
		if(med == b[i]){
			printf("0\n");
			continue;
		}
		if(ind % 2 == 0){
			k = 1;
		}	
		x = 2*ind - n + k;	
		if(med > b[i]){
			if(ind%2 == 0){
				x = -x;
			}
			else{
				x = -(x+1);
			}
		}
		printf("%d\n", x);
	}
	return 0;
}