#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;
    }
    *p = *p + 1;
    return leva;
}
int main() {
    int N, Q, i, r, j, p = 0, res = 0;
    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++) {
        std::cin >> b[i];
        r = binarna(a, b[i], N - 1,&p);
        if(N != p)
            res++;
        N = p;
        res += abs(N/2 - r);
        std::cout << res;
    }
}