#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
     int n,q,ans;
     ans = 0;
     cin >> n >> q;
     vector<int> a(n);
     vector<int> b(q);
     for(int i=0;i<n;++i){
        cin>>a[i];
     }
     sort(a.begin(),a.end());
     for(int i=0;i<q;++i){
        cin>>b[i];
     }
     int mid;
     for(int i=0;i<q;++i){
        auto lb = lower_bound(a.begin(), a.end(), b[i]);
        mid = lb - a.begin();
        if(a[mid] == a[n/2]){
            mid=n/2;
        }
        if(mid>n/2){
            ans = mid-(n-mid);
        }
        else{
            if(b[i]!=a[mid]){
                ans = n-mid - mid + 1;
            }
            else{
                ans = n-1-mid-mid;
            }
        }
        cout << ans << endl;
     }
     return 0;
}