#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,q,p,pp;
    cin>>n>>q;
    int a[n],b[q];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<q;i++)
        cin>>b[i];
    sort(a,a+n);
    for(int i=0;i<q;i++){
        p=0;
        while(p<n&&a[p]<b[i])
            p++;
        if(p>n/2)
            cout<<2*p-n<<endl;
        else if(a[p]!=b[i]){
            cout<<n-2*p+3<<endl;
        }else{
            pp=p;
            while(pp<n&&a[pp]==a[p])
                pp++;
            if(pp>n/2)
                cout<<0<<endl;
            else
                cout<<n-2*pp+3<<endl;
        }
    }
    return 0;}