#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,q;
    cin>>n>>q;
    int a[n];
    for (int i=0; i<n; ++i){
        cin>>a[i];
    }
    sort(a,a+n);
    for (int i=0; i<q; ++i){
        int x;
        cin>>x;
        int bm=lower_bound(a,a+n,x)-a;
        int bv=n-(upper_bound(a,a+n,x)-a);
        int bj=n-bv-bm;
        if (bj==0){
            if (bm==bv || bm==bv+1){cout<<1<<" ";}
            else if (bm<bv){
                cout<<bv-bm+1<<" ";
            }
            else{
                cout<<bm-bv<<endl;
            }
        }
        else{
            if (a[n/2]==x){cout<<0<<" ";}
            else if (bm>bv){
                int y = n-1-bm;
                cout<<bm-y-1<<" ";
            }
            else{
                int z = n-1-bv;
                cout<<bv-z<<" ";
            }
        }
        cout<<endl;
    }
    return 0;
}