#include <iostream>
#include <algorithm>

using namespace std;

int sadrzi(int a[], int n, int x)
{
    int levo=0, desno=n-1;
    while (levo<=desno)
    {
        int sredina=levo+(desno-levo)/2;
        if (x<a[sredina])
            desno=sredina-1;
        else if (x>a[sredina])
            levo=sredina+1;
        else
            return sredina;
    }
    return -1;
}

int unos(int a[], int n)
{
    for(int i=0; i<n; i++)
        cin >> a[i];
}

int slucaj(int x, int a[], int n, int med)
{
    if(x==med)
        return 0;
    int pom = sadrzi(a,n,x);
    if(pom!=-1){
        return pom-(n-1-pom)-1;
    }
    else
        return n;
}

int main()
{
    int n, q, med;
    cin >> n >> q;
    int a[n], b[q];
    unos(a,n);
    sort(a,a+n);
    unos(b,q);
    med=a[n/2];

    for(int i=0; i<q-1; i++){
        cout << abs(slucaj(b[i],a,n,med)) << endl;
    }
    cout << abs(slucaj(b[q-1],a,n,med));

    return 0;
}