#include<bits/stdc++.h>
using namespace std;

double medijana(vector<int> a, int size){
	
	if (size % 2 == 0){
	
		nth_element(a.begin(), a.begin() + size / 2, a.end());
		nth_element(a.begin(), a.begin() + (size - 1) / 2, a.end());
		return (double)(a[(size + 1) / 2] + a[size / 2]) / 2.0;
	}
	else {
		nth_element(a.begin(), a.begin() + size / 2, a.end());
		return (double)a[size / 2];
	}
}

int main(){
cin.tie(NULL);
ios_base::sync_with_stdio(false);

	int duzinaA, duzinaB, a, b;
	cin >> duzinaA >> duzinaB;
	vector <int> nizA, nizB;
	for (int i=0; i <duzinaA; i++)
		cin >> a;
		nizA.push_back(a);
	for (int i=0; i <duzinaB; i++)
		cin >> b;
		nizB.push_back(b);
       
	int medijanaA=medijana(nizA, duzinaA);
	int duzinaC = duzinaA;
	vector<int> nizC;
	
	for (int i = 0; i<duzinaA; i++) {
		nizC.push_back(nizA[i]);
	}
	int cheater; cheater = 0;
	int k;
	for (k=0; k<duzinaB; k++) {
		int b = nizB[k];
		int medijanaC = medijana(nizC, duzinaC);
		
		switch (medijanaC-b){
			case 0:
				cout << 0 << '\n';
				break;

		default:
			for (int i=0; medijanaC!=b; i++) {
				nizC.push_back(nizB[k]);
				duzinaC += 1;
				sort(nizC.begin(), nizC.end());
				medijanaC=medijana(nizC, duzinaC);
				cheater++;
			}
				cout << cheater << '\n';
				break;
		}

			
	}
		
	
	

return 0;
}