#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int indexBsearch(int a, vector<int>& data, int l, int d){
    while(d-l >= 2){
        int m = (l+d)/2;
        if(data[m] > a) d = m;
        else l = m;
    }
    if(data[l] == a) return l;
    if(data[d] == a) return d;
    return -1;
}

int main(){
    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 medijana, indeksmedijane;
    if(n%2 == 0) indeksmedijane = n/2 + 1;
    else indeksmedijane = n/2;
    medijana = a[indeksmedijane];
    
    int c;
    for(int i = 0; i < q; i++){
        cin >> c;
        int l = 0, d = n - 1;
        int indeks = indexBsearch(c, a, 0, n - 1);
        if(c == medijana) cout << 0 << "\n";
        else if(indeks == -1) cout << n << "\n";
        else{
            if(indeks > indeksmedijane) cout << 2*indeks - n << "\n";
            else cout << 2*indeks - n + 1<< "\n";
        }
    }

    return 0;
}