#include <bits/stdc++.h>

using namespace std;



int main(){
    int n,q;
    cin >> n >> q;
    vector<int> a (n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    int as = a.size();
    sort(a.begin(),a.end());
    for(int i = 0;i<q;i++){
        int t;
        cin >> t;
        int l = 0;
        int r = as-1;
        int res = 0;
        while(l<r){
            int mid = (l+r+1)/2;
            if(a[mid] > t){
                r=mid-1;
            }
            else{
                l=mid;
            }
        }
        int rres = r;
        l = 0;
        r = as-1;
        while(l<r){
            int mid = (l+r)/2;
            if(a[mid] >= t){
                r=mid;
            }
            else{
                l=mid+1;
            }
        }
        int lres = l;
        //cout << lres << ":" << rres <<endl;
        if(t>a[as-1]) lres = as;
        if(t<a[0]) rres = -1;
        
        if(a[as/2]>t){
            res -= (as+1)%2;
            res += ((as/2) - rres)*2;
        }
        else if(a[as/2]<t){
            res -= as%2;
            res += (lres-(as/2))*2;
        }
        cout << res <<endl;
    }
    cout << endl;
    return 0;
}