#include <bits/stdc++.h>
using namespace std;
int n,q,b,indeks,medijana,v;
vector <int> a,c;
int getClosest(int val1, int val2,
			int target, int mid)
{
	if (target - val1 >= val2 - b){
        return mid;
	}

	else{
        return mid-1;
	}
}
int findClosest(int n, int b)
{
	if (b <= a[0])
		return 0;
	if (b >= a[n - 1])
		return n - 1;
	int i = 0, j = n, mid = 0;
	while (i < j) {
		mid = (i + j) / 2;

		if (a[mid] == b){
            return mid;
		}

		if (b < a[mid]) {
			if (mid > 0 && b > a[mid - 1])
				return getClosest(a[mid - 1],
								a[mid], b, mid);
			j = mid;
		}
		else {
			if (mid < n - 1 && b < a[mid + 1])
				return getClosest(a[mid],
                a[mid + 1], b, mid);
			i = mid + 1;
		}
	}
	return mid;
}
int main(){
  //freopen("writing.in","r",stdin);
  //freopen("writing2.out","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> q;
  for(int i=1; i<=n; i++){
    cin >> v;
    a.push_back(v);
  }
  sort(a.begin(),a.end());
  medijana=n/2;
  //cout << medijana << endl;
  for(int i=0; i<q; i++){
    c=a;
    cin >> b;
    indeks=(findClosest(n, b));
    if(a[indeks]<b)indeks++;
        for(int j=0; true; j++){
        if(c[c.size()/2]==b){
          cout << j << endl;
          break;
        }
        c.insert(c.begin()+indeks+j,b);
        /*
            for(int i=0; i<c.size(); i++)cout << c[i] << " ";
            cout << endl;
            */
      }
    }
  return 0;
}