#include <iostream>
#include <vector>
#include <algorithm>
#define forn(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const int oo = 2e5+7;
int n,q;
ll a[oo];
int koliko(bool parnost, bool x_levo) {
    if (x_levo) {
        if (parnost) return 1;
        else return 2;
    } else {
        if (parnost) return 2;
        else return 1;
    }
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> q;
    forn(i, n) cin >> a[i];
    sort(a,a+n);
    pair<int, int> range[n];
    ll lastn = -1;
    int lasti = -1;
    forn(i, n) {
        if (a[i] == lastn) {
            range[i] = {range[i-1].first, i};
        } else {
            if (i > 0)
            for (int j = lasti; j < i; j++) range[j].second = range[i-1].second;
            lastn = a[i];
            lasti = i;
            range[i] = {i, i};
        }
    }
    for (int j = lasti; j < n; j++) range[lasti].second = n-1;
    vector<pair<ll, int>> upit;
    forn(i, q) {
        ll x;
        cin >> x;
        upit.push_back({x,i});
    }
    sort(upit.begin(), upit.end());
    int ans[q];
    int levi=-1,desni=0;
    forn(i, q) {
        ll x = upit[i].first;
        int qu = upit[i].second;
        while (levi != n-1 && a[levi+1] <= x) levi++;
        while (desni != n && a[desni] < x) desni++;
        int dodatak = levi != desni;
        ans[qu] = dodatak;

        int pos;
        if (!dodatak) pos = n / 2;
        else pos = (n+1)/2;
        int posx = desni;

        if (posx == pos) continue;
        if (!dodatak) {
            if (posx < pos) {
                posx = range[posx].second;
                if (posx >= pos) continue;
            } else {
                posx = range[posx].first;
                if (posx <= pos) continue;
            }
        }

        int dist = abs(posx - pos);
        ans[qu] += (dist - 1) * 2;
        ans[qu] += koliko((n + dodatak) % 2 == 0, posx < pos);
    }
    forn(i, q) cout << ans[i] << endl;
}