#include <bits/stdc++.h>
using namespace std;

const int mxN = 2e5+7;
int a[mxN];

int bin(int a[], int l, int r, int x){
    while(l<=r){
        int m = (l+r)/2;
        if(a[m]==x){return m;}
        else if(a[m]>x){r=m-1;}
        else{l=m+1;}
    }
    return -1;
}

int bin2(int a[], int l, int r, int x, int n){
    int ans = n;
    while(l<=r){
        int m = (r-l)/2+l;
        if(a[m]>x){r=m-1; ans=m;}
        else{l=m+1;}
    }
    return ans;
}

void solve(){
    int n, q; cin >> n >> q;
    for(int i=0; i<n; i++){cin >> a[i];}
    sort(a, a+n);
    int idx, ans;
    while(q--){
        int x; cin >> x;
        if(bin(a, 0, n-1, x) != -1){
            idx = bin(a, 0, n-1, x);
            ans = abs((n-1) - 2*idx);
            if(n%2==1 && idx > n/2){ans--;}
            else if(n%2==0 && idx >= n/2){ans--;}
        }
        else{
            idx = bin2(a, 0, n-1, x, n);
            ans = abs(n - 2*idx)+1;
            if((n+1)%2==1 && idx > (n+1)/2){ans--;}
            else if((n+1)%2==0 && idx >= (n+1)/2){ans--;}
        }
        cout << ans << "\n";
    }
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cerr.tie(0);
    solve();
    return 0;
}