#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#define MAX 1000000000
using namespace std;

int binarna(long long a[],int l,int d,int x)
{
    int s;
    //printf("\n%d %d %d\n",l,d,x);
    if(l>d)
        return -1;
    s=(l+d)/2;
    if(x==a[s])
        return s;
    if(x<a[s])
    return binarna(a,l,s-1,x);
    if(x>a[s])
        return binarna(a,s+1,d,x);
}

int trazi(long long a[],int n,int x)
{
    int b=binarna(a,1,n,x);
    int s=n/2+1;

    if(b!=-1)
    {if(b<s)
    {
        while(a[b+1]==x)
            b++;

    }
    if(b>s)
    {
        while(a[b-1]==x)
            b--;

    }
    return abs(s-b);}
   else
    {a[n+1]=x;
    n++;
    sort(a,a+n);


    b=binarna(a,1,n,x);
    }
   return abs(2*b-1-n);


}
long long a[10000000],b[100000000];

int main()
{

    int n,q;
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
     for(int i=1;i<=q;i++)
        scanf("%d",&b[i]);
    sort(a,a+n);
    int br;
    for(int i=1;i<=q;i++)
    {
        br=trazi(a,n,b[i]);
        printf("%d\n",br);

    }

    return 0;
}