#include<bits/stdc++.h>

using namespace std;

long indeks(vector<long> niz, long x){
    long pocetak = 0, kraj = niz.size() - 1, sredina = 0;

    while(pocetak <= kraj){
        sredina = pocetak + (kraj - pocetak) / 2;


        if(x < niz[sredina]) kraj = sredina - 1;

        else if(x > niz[sredina]) pocetak = sredina + 1;

        else return sredina;
    }

    return -1;
}

int main(int argc, char **argv){

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    long N, Q, temp = 0, medijana = 0, X = 0, dodatniGlasovi = 0;
    vector<long> A, B;

    cin >> N >> Q;

    for(long i = 0; i < N; i++){
        cin >> temp;
        A.push_back(temp);
    }
    for(long i = 0; i < Q; i++){
        cin >> temp;
        B.push_back(temp);
    }

    sort(A.begin(), A.end());

    medijana = A[N/2];

    for(long i = 0; i < Q; i++){
        X = indeks(A, B[i]); 
        if(X == -1){
            ++N;
            A.push_back(B[i]);
            sort(A.begin(), A.end());
            X = indeks(A, B[i]); 
            dodatniGlasovi = (X < N/2) ? pow(2, abs(X - N/2)) : pow(2, abs(X - N/2)) + 1;
            cout << dodatniGlasovi << '\n';
            --N;
            auto iter = A.begin() + X;
            A.erase(iter);
            continue;
        } else {
            dodatniGlasovi = pow(2, abs(X - N/2)) - 1;
            cout << dodatniGlasovi << '\n';
        }
    }
}