#include <bits/stdc++.h>

using namespace std;

#define MAXN 200010

long long n,q;
long long niz[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>q;

    for (long long i=1;i<=n;i++) cin>>niz[i];

    sort(niz+1,niz+n+1);

    for (long long i=1;i<=q;i++)
    {
        long long x; cin>>x;

        long long rez=(lower_bound(niz+1,niz+n+1,x)-niz);

        if (niz[rez]==x)
        {
            long long medijana=(n/2)+1;

            if (x==niz[medijana]) cout<<0<<endl;
            else if (x<niz[medijana])
            {
                long long raz=abs(medijana-rez);

                if (n%2==0) cout<<2*raz-1<<endl;
                else cout<<2*raz<<endl;
            }

            else
            {
                long long raz=abs(medijana-rez);

                if (n%2==0) cout<<2*raz<<endl;
                else cout<<2*raz-1<<endl;
            }
        }

        else
        {
            long long medijana=(n/2)+1;

            if (x>niz[medijana])
            {
                long long raz=abs(medijana-rez);
                if (n%2==0) cout<<2*raz<<endl;
                else cout<<2*raz-1<<endl;
            }

            else
            {
                medijana++;
                long long raz=abs(medijana-rez);
                if (n%2==0) cout<<2*raz-1<<endl;
                else cout<<2*raz<<endl;
            }
        }
    }
}