#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int func(int niz[],int br)
{
    return niz[br/2];
}

int main()
{
    int N,Q;
    scanf("%d %d",&N,&Q);

    int A[N],B[Q],As[N];

    for (int i=0;i<N;i++) {
        scanf("%d",&A[i]);
        As[i]=A[i]; }
    for (int i=0;i<Q;i++)
        scanf("%d",&B[i]);

    for (int i=0;i<N;i++)
    for (int j=i+1;j<N;j++)
    {
        if (As[j]<As[i]) {
            int t=As[i];
            As[i]=As[j];
            As[j]=t; }
    }
    for (int i=0;i<Q;i++)
    {
        if (B[i]==func(As,N))
            printf("0\n");
        else {
            int brojac=-1, brojacm;
            for (int j=0;j<N;j++)
            {
                if (As[j]==B[i])
                    brojac=j+1;
                if (As[j]==func(As,N))
                    brojacm=j+1;
            }
            if (brojac==-1)
                printf("%d\n",N);
            else
            {
                if(N%2!=0)
                {
                    if(brojacm-brojac>0)
                        printf("%d\n",(brojacm-brojac)*2);
                    else
                        printf("%d\n",abs(brojacm-brojac)*2-1);
                }
                else
                {
                    if(brojacm-brojac>0)
                        printf("%d\n",(brojacm-brojac)*2-1);
                    else
                        printf("%d\n",abs(brojacm-brojac)*3-1);
                }
            }
        }
    }
}