#include <iostream>
#include <algorithm>
#include <vector>


using namespace std;


int b[300000];



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin>>n>>m;
    int x;
    vector <int> vec;
    for(int i=0; i<n; i++)
    {
        cin>>x;
        vec.push_back(x);
    }
    sort(vec.begin(), vec.end());
    int in;
    for(int i=0; i<m; i++)
    {
        cin>>b[i];
        if(find(vec.begin(), vec.end(), b[i])!=vec.end())
        {
            if(vec[n/2]==b[i])cout<<0<<endl;
            else
            {
                if(vec[n/2]>b[i])
                {
                    in=upper_bound(vec.begin(), vec.end(), b[i])-vec.begin()-1;
                    cout<<n-2*in-1<<endl;

                }
                else
                {
                    in=lower_bound(vec.begin(), vec.end(), b[i])-vec.begin();
                    cout<<2*in-n<<endl;
                }
            }
        }
        else
        {
            in=upper_bound(vec.begin(), vec.end(), b[i])-vec.begin();
            if(in==n-in)cout<<1<<endl;
            else
            {
                if(b[i]>vec[n/2])
                {
                    cout<<2*in-n<<endl;
                }
                else
                    cout<<n-2*in+1<<endl;
            }


        }


    }

}