#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <string.h>
#include <map>
#include <iterator>
#include <math.h>

using namespace std;

long long int n,q;
long long int med;
long long int x, k;
vector<long long int>a;

int main(){

    cin >> n;
    cin >> q;

    
    for(long long int i = 0; i < n; i++){
        cin >> k;
        a.push_back(k);
    }

    sort(a.begin(), a.end());

    med = a[a.size() / 2];

    long long int brojac = 0;
    for(long long int i = 0; i < q; i++){
        cin >> x;
        if(x == med){
            cout << 0 << endl;
            continue;
        }

        if(x < a[0]){
            cout << n + 1 << endl;
            continue;
        }

        else if(x > med){
            if(n % 2 != 0){

                long long int d = (distance(a.begin(), lower_bound(a.begin(), a.end(), x)) - (n/2));
                cout << d * 2 - 1 << endl;
                continue;
            }
            else{
                long long int d = (distance(a.begin(), lower_bound(a.begin(), a.end(), x)) - (n/2));
                cout << d * 2 << endl;
                continue;
            }
        }

        else if(x < med){
            if(n % 2 != 0){
                long long int d = (n/2 - (distance(a.begin(), upper_bound(a.begin(), a.end(), x)) - 1));
                cout << d * 2 << endl;
                continue;
            }
            else
            {
                long long int d = (n/2 - distance(a.begin(), upper_bound(a.begin(), a.end(), x) - 1));
                cout << d * 2 - 1 << endl;
                continue;
            }
        }
    }

    return 0;
}