#include <iostream>
#include <vector>

using namespace std;

int binarySearch(vector<int> vec, int a);

int main(int argc, const char * argv[]) {
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    vector<int> res(q);
    int upit;
    int f;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    
    for(int i = 0; i < q; ++i){
        cin >> upit;
        f = binarySearch(a, upit);
        if(f == a.size()){
            res[i] = a.size();
        }
        else{
            if(f == a.size()/2){
                res[i] = 0;
            }
            else if(f > a.size()/2){
                res[i] = f*2-a.size();
            }
            else{
                res[i] = a.size()-2*f-2;
            }
        }
    }
    
    for(int i = 0; i < q; ++i){
        cout << res[i] << endl;
    }
    return 0;
}

int binarySearch(vector<int> vec, int a){
    int beg = 0;
    int end = vec.size()-1;
    int mid;
    if(vec[beg] == a || vec[beg] > a){
        return beg;
    }
    if(vec[end] == a){
        return end;
    }
    if(a > vec[end]){
        return vec.size();
    }
    
    while(beg < end-1){
        mid = (beg + end)/2;
        if(vec[mid] == a){
            return mid;
        }
        else if(vec[mid] < a){
            beg = mid;
        }
        else{
            end = mid;
        }
    }
    return end;
}