#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n, q;
	cin >> n >> q;
	vector<int> a(n);
	vector<int> b(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < q; i++) cin >> b[i];
	sort(a.begin(), a.end());
	int med = n / 2;
	for (int i = 0; i < q; i++) {
		int t = b[i];
		int ind = -1;
		if (a[med] == t) {
			cout << 0 << endl;
			continue;
		}
		else if (a[med] > t) {
			for (int j = 0; j < n; j++) {
				if (a[j] == t) ind = j;
			}
		}
		else if (a[med] < t) {
			for (int j = 0; j < n; j++) {
				if (a[j] == t) {
					ind = j;
					break;
				}
			}
		}
		if (ind == -1) {
			int dod = 0;
			for (int j = 0; j < n; j++) {
				if (a[j] < t) dod = j;
				else break;
			}
			int diff = abs(dod - med);
			cout << diff * 2 + (t > a[med] ? 1 : 0)<<endl;
		}
		else {
			int diff = abs(ind - med) - 1;
			cout << diff * 2 + (t > a[med] ? 1 : 0) << endl;
		}
	}
}