#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    long long n,q;
    cin>>n>>q;
    vector<long long> a;
    for(long long i=0;i<n;i++)
    {
        long long p;
        cin>>p;
        a.push_back(p);
    }
    sort(a.begin(),a.end());
    for(long long i=0;i<q;i++)
    {
        long long b;
        cin>>b;
        auto it = lower_bound(a.begin(),a.end(),b);
        long long x = it-a.begin();
        if(it==a.end()) cout<<n<<endl;
        else
        {
            if(a[x]==b)
            {
                auto ite = upper_bound(a.begin(),a.end(),b);
                long long z = ite-a.begin();
                z--;
                long long p = n/2;
                if(p>=x&&p<=z) cout<<0<<endl;
                else if(x>p)
                {
                    cout<<2*x-n<<endl;
                }
                else if(z<p) cout<<n-1-2*z<<endl;

            }
            else
            {
                long long y = n-x;
                if(x>y) cout<<x-y<<endl;
                else if(x==y) cout<<0<<endl;
                else cout<<1+y-x<<endl;
            }
        }
    }
}