#include <bits/stdc++.h>
#define pb push_back
#define xx first
#define yy second
#define ll long long
#define all(x) (x).begin(),(x).end()

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    int n, q, x;
    cin>>n>>q;
    int ind= n/2;
    int a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];
    sort(a, a+n);
    while(q--){
        cin>>x;
        if(x<a[0]){
            cout<<n+1<<'\n';
            continue;
        }
        if(x>a[n-1]){
            cout<<n<<'\n';
            continue;
        }
        int i1=distance(a, lower_bound(a, a+n, x));
        int i2=distance(a, upper_bound(a, a+n, x))-1;
        if(a[i1]==x){
            if(i1>ind){
                cout<<2*i1-n<<'\n';
            }
            else if(i2<ind){
                cout<<n-2*i2-1<<'\n';
            }
            else cout<<0<<'\n';
        }
        else{
            if(i1<=ind){
                cout<<n-2*i1+1<<'\n';
            }
            else{
                cout<<2*i1-n<<'\n';
            }
        }

    }
    return 0;
}