#include<bits/stdc++.h>

using namespace std;

int main(){
    int n, q;
    cin>>n>>q;
    vector<int> a(n);
    vector<int> b(q);
    for(int i = 0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    for(int i = 0;i<q;i++){
        cin>>b[i];
        int d1 = lower_bound(a.begin(), a.end(), b[i])-a.begin();
        int d2 = upper_bound(a.begin(), a.end(), b[i])-a.begin()-1;
        int r = 0;
        if(d1>=n){
            r = n;
        } else if(a[d1]!=b[i]){
            if(d1<=(n+1)/2){
                r = n-2*d1+1;
            } else{
                r = 2*d1-n;
            }
        } else{
            if((d1<=n/2)&&(d2>=n/2)){
                r = 0;
            } else if(d1>n/2){
                r = 2*d1-n;
            } else{
                //cout<<"AAA"<<endl;
                r = n-2*d2-1;
            }
        }
        cout<<r<<endl;
    }



    return 0;
}