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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define FOR(i, n) for (int i = 0; i < n; ++i)
const vector<pair<int, int>> nb = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}, {-1, 0}, {1, 0}, {0, 1}, {0, -1}};
const vector<pair<int, int>> nc = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }
const int maxN = 2 * 1e5 + 1;

int n,q;
ll a[maxN],b[maxN];

void solve(){
	int med = n/2;
	sort(a,a+n);
	for(int i=0;i<q;++i){
		int k = 0, x = b[i];
		for(int j=n/2;j>=1;j/=2){
			while(k+j<n && a[k+j]<=x)k+=j;
		}
		if(a[k]==x){
			if(a[k]<a[med])cout<<(n-k)-1<<"\n";
			else cout<<abs(med-k)<<"\n";
		}else{
			cout<<n<<"\n";
		}
	}
}


int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>q;
	FOR(i,n)cin>>a[i];
	FOR(i,q)cin>>b[i];
	solve();
	return 0;
}