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

int bs(int arr[], int l, int r, int x){
    if (r >= l) {
        int mid = l + (r - l) / 2;
        if (arr[mid] == x){
            return mid;
        }
        else if (arr[mid] > x){
            return bs(arr, 0, mid-1, x);
        }
        return bs(arr, mid+1, r, x);
    }
    return -1;
}
int main(){
    int n,q;
    cin>>n>>q;
    int a[n]={0};
    for (int i=0; i<n; i++){
        cin>>a[i];
    }
    int b[q];
    for (int i=0; i<q; i++){
        cin>>b[i];
    }
    for (int i=0; i<q; i++){
        sort(a, a+n);
        int x = bs(a, 0, n,b[i]);
        int c[n+1];
        if (x==-1){
            for (int i=0; i<n; i++){
                c[i]=a[i];
            }
            c[n]=b[i];
            sort(c,c+n+1);
            x = bs(c, 0, n,b[i]);
        }
        if (bs(a, 0, n,b[i])==x){
            if (n%2==1){
                if (x==n/2){
                    cout<<0<<endl;
                }
                else if (x<n/2){
                    cout<<(n-x-1)-x<<endl;
                }
                else{
                    cout<<x-n+x<<endl;
                }
            }
            else{
                if (x=n/2+1){
                    cout<<0<<endl;
                }
                else if(x<n/2+1){
                    cout<<n-x-x<<endl;
                }
                else{
                    cout<<x+x-n<<endl;
                }
            }
        }

        else{
            if (n%2==0){
                if (x<n/2 && x>n/2-1){
                    cout<<1<<endl;
                }
                else if (x<=n/2-1){
                    cout<<n-x-x<<endl;
                }
                else{
                    cout<<x+x-n-1<<endl;
                }
            }
            else{
                if(x>n/2 && x<=n/2+1){
                    cout<<1<<endl;
                }
                else if(x<=n/2){
                    cout<<n-x-x+1<<endl;
                }
                else{
                    cout<<x+x-n<<endl;
                }
            }
        }
    }
}