#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int n, q, x, poz = 0, N;
    vector<int>a, b;
    cin >> n >> q;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        a.push_back(x);
    }
    for (int i = 0; i < q; i++)
    {
        cin >> x;
        b.push_back(x);
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < q; i++)
    {
        x = 0;
        for (int j = 0; j < n; j++)
        {
            if (b[i] <= a[j])
            {
                poz = j;
                break;
            }
        }

        if (b[i] == a[poz])
        {
            N = n;
        }

        else
        {
            if (b[i] > a[poz])
            {
                 poz = n;
            }
         N = n + 1;
        }

        if (N / 2 == poz)
        {
            cout << 0 << endl;
            continue;
        }

        x += abs(N - 2*poz);

        if (poz < N / 2)
        {
            if ((N - (x - 1)) / 2 == poz)
                x--;
        }
        else
        {
            if ((N + (x - 1)) / 2 == poz)
                x--;
        }
        if (n != N)
            x++;
        cout << x << endl;
    }

}