#include <bits/stdc++.h>


using namespace std;

int main()
{
    long long n, q;
    long long i, med, temp;
    cin >> n >> q;
    long long a[n], b[q], rez[q];
    for(i=0; i<n; i++)
        cin >> a[i];
    for(i=0; i<q; i++)
    {
        cin >> b[i];
        rez[i] = 0;
    }
    sort(a, a+n);
    med = n/2;
    for(i=0; i<q; i++)
    {
        if(b[i] == a[med])
            rez[i] = 0;
        else if(b[i] > a[n-1])
            rez[i] = n;
        else if(b[i] == a[n-1])
            rez[i] = distance(a, find(a, a+n, b[i])) - 1;
        else
        {
            temp = distance(a, find(a, a+n, b[i])) - 1;
            rez[i] = 3 * temp - n;
        }
    }
    //cout << temp << " "  << med << endl;
    for(i=0; i<q; i++)
        cout << rez[i] << endl;
    return 0;
}