#include <bits/stdc++.h>

using namespace std;

int n,q,n1;
int A[1000000],B[1000000],Q[1000000];


int findlowindex(int key)
{
    int low = 0;
    int high =  n - 1;
    int mid = high / 2;


    while (low <= high)
    {
        int mid_elem = A[mid];

        if (mid_elem < key)
        {
            low = mid + 1;
        }
        else
        {
            high = mid - 1;
        }
        mid = low + (high - low) / 2;
    }


    if (low < n && A[low] == key)
    {
        return low;
    }
    n1++;
    return low;
}


int findhighindex(int key)
{
    int low = 0;
    int high = n - 1;
    int mid = high/2;


    while (low <= high)
    {
        int mid_elem = A[mid];
        if (mid_elem <= key)
        {
            low = mid+1;
        }
        else
        {
            high = mid-1;
        }

        mid = low + (high-low)/2;
    }


    if(high == -1)
    {
        return high+1;
    }
    if (high < n && A[high] == key)
    {
        return high+1;
    }
    n1++;
    return high+1;
}


int findK(int k)
{
    if(k == A[n/2])
    {
        return n/2;
    }
    if(k > A[n/2]) // desno je
    {
        //treba nam levlji
        return findlowindex(k);

    }
    else               //levo je
    {
        //treba nam desniji
        return findhighindex(k);
    }
}

int racunaj(int a) // koliko elemenata treba dodati
{
    int rez=0;
    int l = a;
    int r = n1 - a - 1;


    if(n1 > n)
    {
        rez++;
    }


    if(l == r or l + 1 == r)
    {
        return 0;
    }
    if(l > r)
    {
        return rez + l - r - 1;
    }
    return rez + r - l;
}



int main()
{
    cin>>n>>q;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    for(int i=0;i<q;i++)
    {
        cin>>Q[i];
    }
    sort(A,A+n);


    int k,rez;
    for(int i=0;i<q;i++)
    {
        n1 = n;
        k = Q[i];
        k = findK(k);
        Q[i] = racunaj(k);
    }


    for(int i=0;i<q;i++)
    {
        cout<<Q[i]<<endl;
    }
    return 0;
}