#include <bits/stdc++.h>
using namespace std;

int main(){
	int N, Q;
	cin >> N >> Q;
	int A[1010], B[1010];
	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_i = N/2;
	
	int a, b, c;
	int C[1010];
	for(int i = 0; i < Q; i++){ 
		if(B[i] == A[med_i]){
			C[i] = 0;
			continue;
		}
		if(B[i] < A[med_i]){
			a = -1;
			b = N;
			while(b - a > 1){
				c = (a + b)/2;
				if(B[i] < A[c]){
					b = c;
				} else a = c;
			}
		} else {
			a = -1;
			b = N;
			while(b - a > 1){
				c = (a + b)/2;
				if(B[i] > A[c]){
					a = c;
				} else b = c;
			}
		}
		if(N % 2 == 1){
			if(B[i] < A[med_i]){
				C[i] = (med_i - a) * 2;
			} else C[i] = (b - med_i) * 2 - 1;
		} else {
			if(B[i] < A[med_i]){
				C[i] = (med_i - b) * 2 + 1;
			} else C[i] = (b - med_i) * 2;
		}
	}
	for(int i = 0; i < Q; i++){
		cout << C[i] << endl;
	}
}