#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,q;
    cin>>n>>q;
    vector<int> gl(n);
    vector<int> b(q);
    for(int i=0; i<n; i++){
        cin>>gl[i];
    }
    for(int i=0; i<q; i++){
        cin>>b[i];
    }
    sort(gl.begin(),gl.end());
    int med = gl[n/2+1];
    int ans[q];
    for(int i=0; i<q; i++){
        if(b[i]<med){
            if(n%2 == 1){
                ans[i] = 2*(n/2+1-lower_bound(0,n/2+1,b[i]));
        }
        else{
            ans[i] = 2*(n/2+1-lower_bound(0,n/2+1,b[i]))-1;
        }
       }
       else if(b[i]==med){
        ans[i] = 0;
       }
       else if(b[i]>med){
        if(b[i]<gl[n]){
            if(n%2 == 1){
            ans[i] = 2*(lower_bound(n/2+1,n,b[i]))-1;
        }
            else{
                ans[i] = 2*(lower_bound(n/2+1,n,b[i]));
            }
        }
        else if(b[i]==gl[n]){
        ans[i] = n-2;
       }
       else if(b[i]>gl[n]){
        ans[i] = n;
       }
       }
    }

    for(int i=0; i<q; i++){
        cout<<ans[i]<<" ";
    }
    return 0;
}