#include <bits/stdc++.h>
	using namespace std;
	int prisutan[99999999];
int getClosest(int,int,int);
int nadji(int arr[], int n, int target)
{
    if (target <= arr[0])
        return 0;
    if (target >= arr[n - 1])
        return n-1;
    int i = 0, j = n, mid = 0;
    while (i < j) {
        mid = (i + j) / 2;
 
        if (arr[mid] == target)
            return mid;

        if (target < arr[mid]) {
            if (mid > 0 && target > arr[mid - 1])
                if( getClosest(arr[mid-1],
                                  arr[mid ], target)==1)
                                  return mid;
                                  else
                                  return mid-1;
            j = mid;
        }
        else {
            if (mid < n - 1 && target < arr[mid + 1])
                if( getClosest(arr[mid],
                                  arr[mid + 1], target)==1)
                                  return mid;
                                  else
                                  return mid+1;
            i = mid + 1;
        }
    }
    return mid;
}
int getClosest(int val1, int val2,
               int target)
{
    if (target - val1 >= val2 - target)
        return 2;
    else
        return 1;
}

int resenje(int n, int x)
{
int levo=x;
int desno=n-(x+1);
if(levo==desno)
return 0;
if(n%2==0&&x==n/2)
return 0;

	if(levo>desno)
	return (levo-desno-1);
	else
	return (desno-levo);
}
	int main()
	{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,q;
	int niz[200001];
	cin>>n>>q;
	for(int i=0;i<n;i++)
	{
		cin>>niz[i];
		prisutan[niz[i]]=1;
	}
	sort(niz,niz+n);
	for(int i=0;i<q;i++)
	{
		int x;
		cin>>x;
		if(prisutan[x]==1)
		{
		int poz=nadji(niz,n,x);
		cout<<resenje(n,poz)<<endl;
		}
		else
		{
		int p=nadji(niz,n,x);
		if(niz[p]<x)
		p++;
		else
		p--;
		int n1=n+1;
		cout<<resenje(n1,p)+1<<endl;
		}
	}
	return 0;
	}