#include <bits/stdc++.h>

using namespace std;

void rijesi(vector<int>& a, int &n, int &x)
{
    if(x==a[n/2])
    {
        cout<<"0\n";
        return;
    }
    if(x>a[n/2])
    {
        int indeks=lower_bound(a.begin()+n/2, a.end(), x)-a.begin();
        cout<<abs(n-2*indeks)<<"\n";
        return;
    }
    vector<int>::iterator upper;
    upper=upper_bound(a.begin(), a.end()-n/2, x);
    if(!binary_search(a.begin(), a.end()-n/2, x))
    {
        int indeks=upper-a.begin();
        cout<<abs(n-2*indeks)+1<<"\n";
        return;
    }
    int indeks=upper-a.begin()-1;
    cout<<abs(n-2*indeks)-1<<"\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,q;
    cin>>n>>q;
    vector<int> a(n);
    sort(a.begin(), a.end());
    int i;
    for(i=0; i<n; i++)
        cin>>a[i];
    int x;
    while(q--)
    {
        cin>>x;
        rijesi(a,n,x);
    }

    return 0;
}