#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<int> a,b;
    int n,q,x,y,m;
    cin>>n>>q;
    for(int i=0; i<n; i++)
    {
        cin>>x;
        a.push_back(x);
    }
    for(int i=0; i<q; i++)
    {
        cin>>y;
        b.push_back(y);
    }
    sort(a.begin(),a.end());
    m=a[n/2];
    for(int k=0; k<q; k++)
    {
        if(b[k]==m)
            cout<<'0'<<endl;
        else
        {

            if(b[k]>m&&binary_search(a.begin(),a.end(),b[k]))
                cout<<lower_bound(a.begin(),a.end(),2)-a.begin()<<endl;
            else
            {
                if(b[k]>m&&!binary_search(a.begin(),a.end(),b[k]))
                    cout<<lower_bound(a.begin(),a.end(),b[k])-a.begin()<<endl;
                else
                {
                    if(b[k]<m&&binary_search(a.begin(),a.end(),b[k]))
                        cout<<upper_bound(a.begin(),a.end(),b[k])-1-a.begin()<<endl;
                    else
                        cout<<upper_bound(a.begin(),a.end(),b[k])-a.begin()<<endl;
                }
            }
        }
    }
    return 0;
}