#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int n, q, cnt = 0, k = 0;
	cin >> n >> q;
	int a[n], b[q], a1[200000];
	bool l = true;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		a1[i] = a[i];
	}
	for(int i = 0; i < q; i++) {
		cin >> b[i];
	}
	sort(begin(a1), begin(a1)+n+k);
	int med = a1[(n+k)/2];
	for(int i = 0; i < q; i++) {
		l = true;
		cnt = 0;
		k = 0;
	  	while(l) {
			if(med == b[i]) {
				cout << cnt << endl;
				l = false;
			}else if(med < b[i]) {
				a1[n+k] = b[i];
				k++;
				sort(begin(a1), begin(a1)+n+k);
				med = a1[(n+k)/2];
				cnt++;
			}else if(med > b[i]) {
				a1[n+k] = b[i];
				k++;
				sort(begin(a1), begin(a1)+n+k);
				med = a1[(n+k)/2];
				cnt++;
			}
		} 
	}
	
	return 0;
}