#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n,q,p,r,e,x,y;
	vector<int>::iterator l,d;
	cin>>n>>q;
	vector<int>A;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		A.push_back(x);
	}
	sort(A.begin(),A.end());
	for(int i=0;i<q;i++)
	{
		cin>>y;
		l=lower_bound(A.begin(),A.end(),y);
		d=upper_bound(A.begin(),A.end(),y);
		p=d-l;
		r=l-A.begin();
		e=n-p-r;
		if(r>p+e)
		{
		cout<<r-(p+e)<<endl;
	    }
		else
		{
		if(e>=r+p)
		{
		cout<<e+1-(r+p)<<endl;
		}
		else
		cout<<"0"<<endl;
	}
	}
}