#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int n, q, i, x, manje, vece, jednako, r;
    cin >> n >> q;
    long long int a[n+1];
    a[0] = -1;
    for(i=1; i<=n; i++)
    {
        cin >> a[i];
    }
    sort(a, a+n+1);
    //for(i=1; i<=n; i++){cout << a[i] << " ";}cout << endl;
    while(q--)
    {
        cin >> x;

        manje=0;vece=0;i=1;
        while(i<=n && a[i]<x){i++;}manje = i-1;
        while(i<=n){if(a[i]>x){vece++;}i++;}
        jednako = n-manje-vece;

        if(a[n/2+1]==x)
        {
            cout << 0 << endl;
        }
        else
        {
            if(manje==vece || manje==(vece+1))
            {
                cout << 1 << endl;
            }
            else if(manje < vece)
            {
                r = vece - manje;

                if(jednako>0)
                {
                    if(jednako>=r)
                    {
                        r = 0;
                        jednako -= r;
                        cout << (n%2==0) << endl;
                    }
                    else
                    {
                        r-=jednako;
                        cout << r + 1 << endl;
                    }
                }
                else
                {
                    cout << r + 1 << endl;
                }
            }
            else
            {
                r = manje - vece;

                if(jednako>0)
                {
                    if(jednako>=r-1)
                    {
                        cout << (n%2==1) << endl;
                    }
                    else
                    {
                        r-=jednako;
                        cout << r + (n%2==1) << endl;
                    }
                }
                else
                {
                    cout << r << endl;
                }
            }
        }
    }
}