#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX 200000
int a[MAX], b[MAX];
int main()
{
    int n, q, l, p, d, k;
    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);
    for (int i = 0;i < q;i++)
    {
        k = floor(n / 2);
        if (a[k] == b[i])
        {
            cout << 0 << endl;
        }
        else
        {
            l = 0;
            p = 0;
            d = 0;
            for (int j = 0;j < n;j++)
            {
                if (a[j] < b[i])
                {
                    l++;
                }
                else if (a[j] > b[i])
                {
                    d++;
                }
                else
                {
                    p++;
                }
            }
            if (p == 0)
            {
                if (l > d)
                {
                    cout << l - d << endl;
                }
                else
                {
                    cout << d - l + 1 << endl;
                }
            }
            else if (l > d)
            {
                d = d + p - 1;
                cout << l - d - 1 << endl;
            }
            else
            {
                l = l + p - 1;
                cout << d - l << endl;
            }
        }
    }
    return 0;
}