#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 2e5 + 2;
const int inf = 2e9;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    int m = n / 2;
    while (q--) {
        int x; cin >> x;
        int i = (int)(lower_bound(a.begin(), a.end(), x) - a.begin());
        if (i <= m) {
            cout << 0 << en;
            continue;
        }
        if (n % 2 == 0) cout << 2 * (i - m) << en;
        else cout << 2 * (i - m) - 1 << en;
    }
    return 0;
}