#include<stdio.h>
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define N 10000005
using namespace std;

int n, q;
int a[20001];
int len;

void solve(int x) {
	int l, r, m;
	bool p = binary_search(a, a + n, x), par = len % 2;
	l = lower_bound(a, a + n, x) - a;
	r = upper_bound(a, a + n, x) - a;
	m = len/2 + 1;
	if (p) {
		r--;
		if (l == m || r == m) {
			cout << "0\n"; return;
		}
		if (r < m) {
			cout << len - 2 * r - 1 << "\n"; return;
		}
		else if (l > m) {
			cout << len - 2 * (len - l) - 2 << "\n"; return;
		}
		else {
			cout << "0\n"; return;
		}
	}
	else {
		if (r <= m) {
			cout << len - 2 * r - 1 << "\n";
		}
		else {
			cout << len - 2 * r - 2 << "\n";
		}
	}
}

//01234567890
//12345678901
//    rl

// 1 3 3 3 4 5
// 
// 0 3 4 5 6 7

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> q;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	len = n;

	sort(a, a + n);
	int qq[20001];

	for (int i = 0; i < q; i++) {
		cin >> qq[i];
	}
	for (int i = 0; i < q; i++) {
		solve(qq[i]);
	}
}