#include <bits/stdc++.h>
#define ll long long
#define vect vector<int>
using namespace std;
signed main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	vect v1 = {};
	vect v2 = {};
	vect v3 = {};
	ll n,q,a,b,x; cin >> n >> q;
	int sum = 0;
	for(int i = 0; i < n; i++){
		cin >> a;
		v1.push_back(a);
	}
	for(int m = 0; m < q; m++){
		cin >> b;
		v2.push_back(b);
}
    sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());
	x = floor(v1.size()/2 );
	int l = v1[x];
	int k1 = *min_element(v1.begin(), v1.end());
	int k2 = *max_element(v1.begin(), v1.end());
	int z = 0;
	for(;z<q; z++){
		if(l == v2[z]){
			v3.push_back(0);
		}
		else if(x < v2[z] && v2[z] < k2){
			if(v1.size() % 2 == 0){
				v3.push_back(abs(v2[z]-l));
			}
			else if(v1.size() % 2 != 0){
				v3.push_back(abs(v2[z]-l)-1);
			}
	    }
	    else if(v2[z] > k1 || v2[z] < k2){
		    v3.push_back(v1.size());
        }
		if (q == v3.size()){
			break;
		}
	}
	 for (auto d : v3) {
		cout << d << endl;
	}
	}