#include <bits/stdc++.h>

using namespace std;

int a[200008];
int b[200008];
int manjih[200008];
int manjejednakih[200008];
int rez[200008];

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

    int n, q; cin >> n >> q;


    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    for(int i = 0; i < q; i++)
    {
        cin >> b[i];
    }

    sort(a, a + n);
    sort(b, b + q);

    int k = 0;

    for(int i = 0; i < n; i++)
    {
        while(b[k] <= a[0] && k < q)
        {
            manjih[k] = 0;
            k++;
        }

        if(i < n - 1)
        {
            while(b[k] > a[i] && b[k] <= a[i + 1])
            {
                manjih[k] = i + 1;
                k++;
            }
        }
    }

    for(int i = k; i < q; i++)
    {
        manjih[i] = n;
    }

    k = 0;

    for(int i = 0; i < n; i++)
    {
        while(b[k] < a[0] && k < q)
        {
            manjejednakih[k] = 0;
            k++;
        }

        if(i < n - 1)
        {
            while(b[k] >= a[i] && b[k] < a[i + 1])
            {
                manjejednakih[k] = i + 1;
                k++;
            }
        }
    }

    for(int i = k; i < q; i++)
    {
        manjejednakih[i] = n;
    }

    int medijana = n / 2;

    for(int i = 0; i < q; i++)
    {
        int m = manjih[i];
        int v = n - manjejednakih[i];
        int t = n - m - v;

        if(medijana > m + t - 1)
        {
            rez[i] = v - m - t + 1;
        }
        else if(medijana < m)
        {
            rez[i] = m - v - t;
        }
        else
        {
            rez[i] = 0;
        }
    }

    for(int i = 0; i < q; i++)
    {
        cout << rez[i] << endl;
    }


    return 0;
}