#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> ktorvi;
    int med[m];
    map<int,int> camapi;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        ktorvi.push_back(x);
        camapi[x]=1;
    }
    sort(ktorvi.begin(),ktorvi.end());
    for(int i=0;i<m;i++)
        cin>>med[i];
    for(int i=0;i<m;i++)
    {
        int rez;
        int ind1=lower_bound(ktorvi.begin(),ktorvi.end(),med[i])-ktorvi.begin();
        int ind2=lower_bound(ktorvi.begin(),ktorvi.end(),med[i]+1)-ktorvi.begin();
        int ind;
        if(ind1<=n/2 && ind2-1>=n/2)
            ind=n/2;
        else if(ind2-1<n/2 && ind2-1>=0)
            if(ind1==ind2)
                ind=ind1;
            else
                ind=ind2-1;
        else if(ind1>n/2)
            ind=ind1;
        if(camapi[med[i]]==1)
        {
            int l=ind;
            int d=n-1-l;
            if(l<d)
                rez=d-l;
            else if(l==d)
                rez=0;
            else
                rez=l-d-1;
        }
        else
        {
            int l=ind;
            int d=n-ind;
            if(d==0)
                rez=n;
            else if (l==0)
                rez=n+1;
            else if(l==d)
                rez=1;
            else if(l<d)
                rez=d-l+1;
            else
                rez=l-d;
        }
        cout<<rez<<endl;
    }
    return 0;
}