#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    cin.tie(0);
    long long n, q, medijana, k;
    cin >> n >> q;
    vector <long long> a(n), b(q);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    medijana = a[(n/2)];
    for(int i = 0; i < q; i++){
        cin >> b[i];
        if(b[i] == medijana){
            cout << "0" << endl;
        }
        else{
            if(binary_search(a.begin(), a.end(), b[i])){
                if(b[i] > medijana){
                    k = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
                    cout << k - n/2 << endl;
                }
                else{
                    k = upper_bound(a.begin(), a.end(), b[i]) - a.begin();
                    cout << n/2 - k << endl;
                }
            }
            else{
                cout << n << endl;
            }
        }
    }
    return 0;
}