#include <bits/stdc++.h>

using namespace std;

#define MAXN 200010

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

int main()
{
    cin>>n>>q;

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

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

    if (q==1)
    {
        long long x; cin>>x;

        n++;
        niz[n]=x;

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

        long long l=1;
        long long r=n;
        long long rez=0;

        while (l<=r)
        {
            long long mid=(l+r)/2;

            if (niz[mid]==x)
            {
                rez=mid;
                break;
            }
            else if (niz[mid]<x) l=mid+1;
            else r=mid-1;
        }

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

        if (x==niz[medijana]) cout<<1<<endl;
        else 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
        {
            long long raz=abs(medijana-rez);

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

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

            long long l=1;
            long long r=n;
            long long rez=0;

            while (l<=r)
            {
                long long mid=(l+r)/2;

                if (niz[mid]==x)
                {
                    rez=mid;
                    break;
                }

                else if (niz[mid]<x) l=mid+1;
                else r=mid-1;
            }

            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;
            }
        }
    }
}