#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
    int n, q;

    cin >> n >> q;

    int a[n], b[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 poz = -1;
    int c[n+1];

    for(int i = 0; i < n; i++) c[i] = a[i];

    for(int i = 0; i < q; i++)
    {
        if(b[i] == a[n/2]) cout << 0 << endl;
        else
        {
            for(int j = 0; j < n; j++)
            {
                if(b[i] == a[j]) poz = j;
            }
            if(poz != -1)
            {
                if(n % 2 == 1)
                {
                    if(b[i] < a[n/2]) cout << (abs(poz - n/2)*2) << endl;
                    else cout << (abs(poz - n/2)*2 - 1) << endl;
                }
                if(n % 2 == 0)
                {
                    if(b[i] < a[n/2]) cout << (abs(poz - n/2)*2 - 1) << endl;
                    else cout << (abs(poz - n/2)*2) << endl;
                }
            }
            if(poz == -1)
            {
                c[n] = b[i];
                sort(c, c+n+1);
                
                if(n % 2 == 1)
                {
                    if(b[i] < a[n/2]) cout << (abs(poz - n/2)*2) << endl;
                    else cout << (abs(poz - n/2)*2 - 1) << endl;
                }
                if(n % 2 == 0)
                {
                    if(b[i] < a[n/2]) cout << (abs(poz - n/2)*2 - 1) << endl;
                    else cout << (abs(poz - n/2)*2) << endl;
                }
            }
            poz = -1;
        }

    }
    return 0;
}