#include <bits/stdc++.h>

using namespace std;

int main()
{
    vector<int> v;
    int n,q;
    scanf("%d%d",&n,&q);
    for(int i=0;i<n;i++){
        int x;
        scanf("%d",&x);
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    int duzina = v.size();
    for(int i=0;i<q;i++){
        int q1;
        scanf("%d",&q1);
        vector<int>::iterator it = find(v.begin(),v.end(),q1);
        if(it!=v.end()){
            int p=it-v.begin();
            if(p<duzina/2){
                printf("%d\n",duzina-1-2*p);
            }else{
                int r = p-1-(duzina-1-p);
                if (r>0){
                    printf("%d\n",r);
                }else{
                    printf("%d\n",0);
                }
            }
        }else{
            vector<int> v1(v);
            v1.push_back(q1);
            sort(v1.begin(),v1.end());
            it = find(v1.begin(),v1.end(),q1);
            int p=it-v1.begin();
            if(p<(duzina+1)/2){
                printf("%d\n",(duzina+1)-2*p);
            }else{
                int r = p-((duzina+1)-1-p);
                if (r>0){
                    printf("%d\n",r);
                }else{
                    printf("%d\n",0);
                }
            }
        }
    }
}