#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    int N, Q;
    cin >> N >> Q;
    int a[N + 1], b[Q], medijana = 0;
    for (int i = 1; i <= N; i++) cin >> a[i];
    for (int i = 0; i < Q; i++) cin >> b[i];
    sort(a + 1, a + N + 1);
    medijana = a[N / 2 + 1];
    for (int i = 0; i < Q; i++) {
        if (b[i] > medijana) cout << (lower_bound(a + 1, a + N + 1, b[i]) - a - 1) * 2 - N << '\n';
        else if (b[i] < medijana) cout << N + 1 - (upper_bound(a + 1, a + N + 1, b[i]) - a - 1) * 2 << '\n';
        else cout << 0 << '\n';
    }
    return 0;
}