#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mn=2*1e5+100;
vector<ll> a(mn);
//PROVERI JOS
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.begin()+n);
    while(q--)
    {
        int k;
        cin>>k;
        vector<ll>::iterator it1=lower_bound(a.begin(),a.begin()+n,k);
        vector<ll>::iterator it2=upper_bound(
        a.begin(),a.begin()+n,k);
        int pos1=it1-a.begin();
        int pos2=it2-a.begin();
        //cout<<pos2<<endl;
        //cout<<pos1<<endl;
        if(pos1>=n)
        {
            cout<<n<<endl;
        }
        else if(pos1==0)
        {
            if(pos2==0)
            {
                cout<<n+1<<endl;
            }
            else
            {
                if(pos2-1>=n/2)
                {
                    cout<<0<<endl;
                }
                else
                {
                    cout<<n+1-2*pos2<<endl;   
                }
            }
        }
        else
        {
            if(pos1<pos2)
            {
                if(pos1<=n/2 && pos2-1>=n/2)
                {
                    cout<<0<<endl;
                }
                else if(pos1<n/2)
                {
                    cout<<n-2*pos2<<endl;
                }
                else 
                {
                    cout<<2*pos1-n<<endl;
                }
            }
            else
            {
                if(pos1==n/2)
                {
                    if(n%2==0) cout<<1<<endl;
                    else cout<<2<<endl;
                }
                else if(pos1<n/2)
                {
                    cout<<n+1-2*pos1<<endl;
                }
                else
                {
                    cout<<2*pos1-n<<endl;
                }

            }

        }
    }
}