#include <bits/stdc++.h>

using namespace std;

int rijesi(vector<int>& a, int &n, int &x)
{
    if(x==a[n/2])
        return 0;
    if(x>a[n/2])
    {
        int indeks=lower_bound(a.begin()+n/2, a.end(), x)-a.begin();
        return abs(n-2*indeks);
    }
    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();
        return abs(n-2*indeks)+1;
    }
    int indeks=upper-a.begin()-1;
    return abs(n-2*indeks)-1;
}

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;
        cout<<rijesi(a,n,x)<<"\n";
    }

    return 0;
}