#include <stdio.h>
#include <stdlib.h>
void sort(long int a[],long int n){
    for(long int i=0;i<n-1;i++)
        for(long int j=0;j<n-i-1;j++)
            if(a[j]>a[j+1]){
                long int t=a[j];
                a[j]=a[j+1];
                a[j+1]=t;}
}
int main()
{
    long int n,q,m;
    scanf("%d%d",&n,&q);
    long int a[n],b[q];
    for(long int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,n);
    if(n%2!=0)
        m=a[(n+1)/2-1];
    else
        m=a[n/2];
    for(long int i=0;i<q;i++){
        scanf("%d",&b[i]);
        if(m==b[i])
            printf("0\n");
        else
            for(long int j=0;j<n;j++){
                if(b[i]==a[j])
                    if(b[i]<m)
                        printf("%d\n",n-2*j-1);
                    else
                        printf("%d\n",abs(n-2*j));
                if((j==0 && b[i]<a[j]) || (j==n-1 && b[i]>a[j]) || (b[i]>a[j] && b[i]<a[j+1]))
                    if(b[i]>m)
                        printf("%d\n",2*j-n+2);
                    else
                        printf("%d\n",abs(2*j-n+2));}}
    return 0;
}