#include "cstdio"
#include "algorithm"

int median(int arr[],int len)
{
    return arr[len/2];
}

int pos(int len)
{
    return len/2;
}

int firstFoundPos(int arr[],int goal,int n)
{
    bool rising = median(arr,n) < goal;
    for(int i = pos(n); rising < goal ? i < n : i > 0;i+= rising < goal ? 1 : -1)
    {
        if(arr[i] == goal) {return i;}
        else if(arr[i] > goal && rising) {return i;}
        else if(arr[i] < goal && !rising) {return i;}
    }
    return 0;
}

int main() {
    int n,q;
    scanf("%d %d",&n,&q);
    int a[n];
    for(int i = 0;i < n;i++) scanf("%d",&a[i]);
    std::sort(a,a+n);
    for(int i = 0;i < q;i++)
    {
        int b;scanf("%d",&b);
        if(i != 0)
        {
            printf("\n");
        }
        if(median(a,n) == b) {printf("%d",0);}
        else if(a[0] > b || a[n-1] < b)
        {
                if(a[n-1] < b)
                {
                    if(n%2==0){printf("%d",2*(n-pos(n)));}
                    else {printf("%d",1+2*(n-pos(n)-1));}
                }
                else
                {
                    if(n%2 == 0){printf("%d",1+2*(pos(n)));}
                    else{printf("%d",2*(pos(n)+1));}
                }
        }
        else
        {
            int goal = firstFoundPos(a,b,n);
            if(goal > 0) {
                if (goal > pos(n)) {
                    if (n % 2 == 0) {
                        printf("%d", 2 + 2 * (goal - pos(n) - 1));
                    } else {
                        printf("%d", 1 + 2 * (goal - pos(n) - 1));
                    }
                } else {
                    if (n % 2 == 0) {
                        printf("%d", 1 + 2 * (pos(n) - goal - 1));
                    } else {
                        printf("%d", 2 * (pos(n) - goal));
                    }
                }
            }
            else
            {
                goal = -goal;
                if(goal > pos(n))
                {
                    if(n%2==0)
                    {
                        printf("%d", 2 * (pos(n) - goal));
                    }
                    else
                    {
                        printf("%d", 1+ 2 * (pos(n) - goal-1));
                    }
                } else
                {
                    if(n%2==0)
                    {
                        printf("%d", 2 * (pos(n) - goal));
                    }
                    else
                    {
                        printf("%d", 1+ 2 * (pos(n) - goal-1));
                    }
                }
            }
        }
    }
}