#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;

int main()
{
    long long int n,q,i,j;
    cin>>n>>q;
    long long int a[n];
    long long int b[q];
    for(i=0;i<n;i++)
        cin>>a[i];
    for(i=0;i<q;i++)
        cin>>b[i];
    sort(a,a+n);
    long long int m;
    if(n%2==1)
    m=n/2+1;
    if(n%2==0)
        m=n/2;
    bool van=false;
    long long int x;

    for(i=0;i<q;i++)
    {
        if(b[i]==a[m-1])
            cout<<0<<endl;
        else if(b[i]==a[0])
            cout<<n-1<<endl;
        else if(b[i]==a[n-1])
            cout<<n-1<<endl;
        else if((b[i]>a[0])&&(b[i]<a[n-1]))
        {

            long long int k=0;
            while(a[k]!=b[i])
                k++;
            x=n-1-k;
            cout<<x<<endl;;
        }
        else if(b[i]>a[n-1])
                cout<<n<<endl;
        else if(b[i]<a[0])
            cout<<n<<endl;
    }
    return 0;
}