#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
pair<int,bool> pretraga(int a[], int n, int x){
    int l = 0, d = n-1;
    bool nasao = false;
    int s = l + (d-l)/2;
    int ind = -1;
    int prvimanji = -1;
    while(l<=d){
        s = l + (d-l)/2;
        if(a[s]==x){
            d = s-1;
            ind = s;
            nasao = true;
        }
        else if(a[s]>x){
            d = s-1;
        }
        else{
            l = s+1;
            prvimanji = s;
        }
    }
    if(ind!=-1){
        return {ind,nasao};
    }
    if(d<l){
        return {prvimanji, nasao};
    }
    return {s,nasao};
}
int main()
{
    int n,q;
    cin>>n>>q;
    int a[n];
    cin>>a[0];
    bool sorted = true;
    for(int i = 1; i<n; i++){
        cin>>a[i];
        if(a[i]<a[i-1]){
            sorted = false;
        }
    }
    int querry[q];
    for(int i = 0; i<q; i++){
        cin>>querry[i];
    }
    if(!sorted){
        sort(a,a+n);
    }
    for(int i = 0; i<q; i++){
        int index = pretraga(a,n,querry[i]).first+1;
        bool nasao = pretraga(a,n,querry[i]).second;
        if(nasao){
            int d = n-index;
            int l = index - 1;
            int rez = abs(d-l);
            if(index%2==0){
                cout<<rez-1<<endl;
            }
            else{
                cout<<rez<<endl;
            }

        }
        else{
            int d = n-index;
            int l = index;
            int rez = abs(d-l);
            if(index==0||(n%2==0&&index == n/2)){
                cout<<rez+1<<endl;
            }
            else{
                cout<<rez<<endl;
            }
        }
    }
    return 0;
}