#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int binarna(vector<int>& v, int l, int r, int x, int m,bool& bul) {
    if (r >= l) {
        m = l + (r - l) / 2;
        if (v[m] == x) return m;
        if (v[m] > x) return binarna(v, l, m - 1, x, m, bul);
        return binarna(v, m + 1, r, x, m + 1, bul);
    }
    bul = false;
    return m;
}

int main()
{
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    vector<int> b(q);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < q; i++)
        cin >> b[i];
    sort(a.begin(), a.end());
    for (int i = 0; i < q; i++) {
        int k = n / 2;
        if (a[k] == b[i])cout << 0 << '\n';
        else {
            bool bul = true;
            int kk = binarna(a, 0, n - 1, b[i], 0, bul);
            if (bul) { //no gud get fckd
                if (n % 2 == 1)
                    cout << abs(kk - k) * 2 - 1 << '\n';
                else cout << abs(kk - k) * 2 << '\n';
            }
            else {
                if (n % 2 == 1)
                    if (b[i] < a[k]) cout << abs(kk - k) * 2 << '\n';
                    else cout << abs(kk - k - 1) * 2 + 1 << '\n';
                else if (b[i] < a[k])cout << abs(kk - k) * 2 + 1 << '\n';
                else cout << abs(kk - k) * 2 << '\n';
            }
        }
    }
}