#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    bool flag = false;
    int N,Q,res = 0;
    cin >> N >> Q;
    vector<long long> A(N);
    for(int i = 0; i<N; i++)
    {
        cin >> A[i];
    }
    sort(A.begin(),A.end());

    for(int q = 0; q<Q; q++)
    {
        long long B;
        cin >> B;
        auto itupper = upper_bound(A.begin(),A.end(),B);
        auto itlower = lower_bound(A.begin(),A.end(),B);
        int poslower = itlower-A.begin();
        int posupper = itupper - A.begin() - 1;
        if(B != A[poslower])
        {
            res++;
            N++;
            posupper++;
            flag = true;
        }
        //cout << poslower << posupper << endl;
        if(N/2 >= poslower && N/2 <= posupper)
        {
            cout << res << endl;
        }
        else
        {
            int closest;
            if(N/2 > posupper)
            {
                closest = posupper;
                cout << N-1 - 2*closest +res<< endl;
            }
            else
            {
                closest = poslower;
                int r = 2*closest - N + res;
                cout << r << endl;
            }
        }


        if(flag)
        {
            N--;
            res--;
            flag = false;
        }
    }
    return 0;
}