#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int binsearch(int n,vector<int> a){
    int l=0;
    int r=a.size();
    if(n>a[r-1] || n<a[l])
    {
        return a.size();
    }
    if(n==a[r-1] || n==a[l])
    {
        return a.size()-1;
    }
    if(n==a[r/2])
        return 0;
        int mid;
    int index;
    while(l<r)
    {
        mid=(l+r)/2;
        if(n>=a[mid])
        {
            index=mid;
            l=mid+1;
        }
        else
            r=mid-1;
    }
    int s=a.size();
    return abs(index-mid)-1;
}
int main()
{
    int n,q;
    cin>>n>>q;
    vector<int> a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    vector<int> pitanja(q);
    for(int i=0;i<q;i++)
        cin>>pitanja[i];
    sort(a.begin(),a.end());
    for(int i=0;i<q;i++){
       cout<<binsearch(pitanja[i],a)<<endl;
    }
    return 0;
}