#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <string>
#include <cstring>
#include <ctime>
#include <set>
#include <list>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <unordered_map>
#include <queue>
#include <deque>
#include <chrono>
#include <fstream>
#include <sstream>
#include <ostream>
#include <assert.h>
#include <cstdint>
#define ll long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265358979323846 
#define all(c) (c).begin(), (c).end()
using namespace std;

void solve() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	for (int& i : a) cin >> i;
	sort(all(a));
	int med = a[(n / 2)];
	for (int i = 0,j; i < m; i++) {
		cin >> j;
		if (j < a[0]) {
			cout << n + 1 << '\n';
		}
		else if (j > a[n - 1]) {
			cout << n << '\n';
		}
		else if (j > med) {
			int id = lower_bound(a.begin() + (n/2), a.end(), j) - a.begin();
			cout << (id - 1) - (n - id - 1) << '\n';
		}
		else if (j < med) {
			int id = lower_bound(a.begin(), a.begin() + (n/2) + 1, j) - a.begin();
			if (a[id] > j) id--;
			cout << (n - id - 1) - id << '\n';
		}
		else cout << "0\n";
	}
}

int main() {
	sync;
	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
}