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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, q, x, br, pi, pc;
	cin >> n >> q;
	vector <int> a, b, c;
	for (int i = 0; i < n; i++){
		cin >> x;
		a.push_back(x);
    }
	for (int i = 0; i < q; i++){
		cin >> x;
		b.push_back(x);
    }
	for (int i = 0; i < q; i++){
		br = 0;
		c.clear();
		c.reserve(a.size());
		copy(a.begin(), a.end(), back_inserter(c));
		if (find(a.begin(), a.end(), b[i]) == a.end()){
			c.push_back(b[i]);
			br++;
		}
		sort(c.begin(), c.end());
		pi = find(c.begin(), c.end(), b[i]) - c.begin();
		pc = c.size();
		while (pi != pc / 2){
			br++;
			pc++;
			if (pi < c.size() / 2){
				pi++;
			}
		}
		cout << br << "\n";
	}
    return 0;
}