#include <iostream>
#include <algorithm>
int binarna(int a[], int x, int desna, int *p) {
    int sred, leva = 0; *p = desna + 1;
    while(leva <= desna) {
        sred = (leva + desna)/2;
        if (x == a[sred])
            return sred;
        else if (x > a[sred])
            leva = sred + 1;
        else
            desna = sred - 1;
    }
    if(leva < *p/2)
        leva++;
    *p = *p + 1;
    return leva;
}
int main() {
    int N, Q, i, r, p = 0, res;
    std::cin >> N >> Q;
    int a[N], b[Q];
    for(i = 0; i < N; i++) {
        std::cin >> a[i];
    }
    std::sort(a, a+N);
    for(i = 0; i < Q; i++) {
        res = 0;
        std::cin >> b[i];
        r = binarna(a, b[i], N-1, &p);
        res = abs(N - 2 * r);
        if (N % 2 == 0){
            if (r < (N/2))
                res--;
        }
        else{
            if (r <= (N/2))
                res--;
        }
        std::cout << res;
        if(i != Q-1)
            std::cout << "\n";
    }
}