#include<stdio.h>
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

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

void solve(int x) {
	int l = 0, r = len - 1, m, ixl, ixr;
	bool p = a[len - len/2] < x;
	m = len - len / 2;
	while (l != r && l != r - 1) {
		if (x == a[m]) {
			cout << m - abs(len - r - 1 - l) << "\n";
			return;
		}
		else if (x > a[m]) {
			l = m;
		}
		else {
			r = m;
		}
		m = l + r - (l + r) / 2;
	}
	m = len / 2;
	ixl = l; ixr = r;

	if (ixr > m) {
		cout << ixl - len + ixr + 1 << "\n"; return;
	}
	else {
		cout << len - ixr << "\n";
	}
}

int main() {
	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]);
	}
}