#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 3;
int a[N], b[N];
#define debug(x) cout<<#x<< " = " << x << endl;

int main() {
    ios::sync_with_stdio(false);
    int n, q; 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);
    int medijana = a[n / 2];

    for (int i = 0; i < q; i++) {
        if (b[i] == medijana) {
            cout << 0 << "\n"; continue;
        }
        if (b[i] > medijana) {
            int poz = lower_bound(a, a + n, b[i]) - a;
            ///racunamo rastojanje od gornje do meridijane.
            poz -= (n / 2);
            int res = poz * 2 - (n % 2 == 1);
            cout << res << "\n";
        } else {
            int poz = upper_bound(a, a + n, b[i]) - a;
            ///racunamo rastojanje od meridijane do donje granice
            poz = (n / 2) - poz + 1;
            int res = poz * 2 - (n % 2 == 0);
            cout << res << "\n";
        }
    }
}