#include <iostream>
#include <algorithm>


using namespace std;

int poz(int a,int b[], int n)
{
    int i=0;
    while (a>b[i]&&i<n)
        i++;
    return i;
}
int main()
{
    int Q,N,M,i,j,P;
    int A[200000];
    int B[200000];
    cin >> N >> Q;
    for (i=0; i<N; i++)
        cin >> A[i];
    for (i=0; i<Q; i++)
        cin >> B[i];
    sort(A,A+N);
    M = N%2;
    P = A[N/2];
    switch(M)
    {
    case 1:
        for(i=0; i<Q; i++)
        {
            j=poz(B[i],A,N);
            if(B[i]==P)
                cout << 0 <<endl;
            else if (B[i]>P)
                cout <<(j-N/2-1)*2+1 << endl;
            else
                cout <<(N/2-j)*2+2<< endl;
        }
        return 0;
    case 0:
        for (i=0; i<Q; i++)
        {
            j=poz(B[i],A,N);
            if(B[i]==P)
                cout << 0 <<endl;
            else if (B[i]>P)
                cout <<(j-N/2-1)*2+2 << endl;
            else
                cout <<(N/2-j)*2+1 << endl;

        }
        return 0;
    }
    return 0;
}