#define _USE_MATH_DEFINES
#include<iostream>
#include<sstream> 
#include<cmath>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<conio.h>
#include<numeric>
#include<map>
#include<set>
#include<stack>
#include<stdlib.h>  
#include<unordered_map>
#include <queue>
using namespace std;

#define int long long

void printvector(vector<int>a) {
    for (int i = 0; i < a.size(); i++) cout << a[i] << " ";
    cout << endl;
}
int bruteforce(vector<int>a, int n, int target, int ind) {
    int ans = 0;
    while (target != a[n / 2]) {
        a.insert(a.begin() + ind, target);
        n++;
        ans++;
    }
    return ans;
}

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    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];
    int ans = 0; int ind;
    int temp = n;
    sort(a.begin(), a.end());
    for (int i = 0; i < q; i++) {
        ans = 0;
        n = temp;
        int br_elem_desno = 0;
        int br_elem_levo = 0;
        if (!binary_search(a.begin(), a.end(), b[i])) {
            auto it = lower_bound(a.begin(), a.end(), b[i]);
            if (it == a.end()) ind = n;
            else ind = it - a.begin();
            n++;
            ans++;
            if (ind == n / 2) { cout << ans << '\n'; continue; }
        }
        else {
            if (b[i] < a[n / 2]) {
                auto it = upper_bound(a.begin(), a.end(), b[i]);
                ind = it - a.begin() - 1;
            }
            else {
                auto it = lower_bound(a.begin(), a.end(), b[i]);
                ind = it - a.begin();
            }
        }
        if (a[((n / 2))] == b[i]) {
            cout << ans << '\n';
            continue;
        }
        else {
            if (ind < n / 2) {
                br_elem_levo = br_elem_levo + ind;
                br_elem_desno = br_elem_desno + n - ind - 1;
                ans = ans + abs(br_elem_levo - br_elem_desno);
                cout << ans << '\n';
            }
            else {
                br_elem_levo = br_elem_levo + ind;
                br_elem_desno = br_elem_desno + n - ind - 1;
                ans = ans + abs(br_elem_levo - br_elem_desno - 1);
                cout << ans << '\n';
            }
        }
    }
    return 0;
}