#include <iostream>
#include <algorithm>
#include <vector>


using namespace std;


int b[300000];



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin>>n>>m;
    int x;
    vector <int> vec;
    for(int i=0; i<n; i++)
    {
        cin>>x;
        vec.push_back(x);
    }
    sort(vec.begin(), vec.end());
    int in;
    int l, r;
    for(int i=0; i<m; i++)
    {
        cin>>b[i];
        in=lower_bound(vec.begin(), vec.end(), b[i])-vec.begin();
        if(in!=n)
        {
            if(vec[in]==b[i])cout<<abs(n/2-in)<<endl;
            else
            {
                l=in, r=n-in;
                if(l>=r)
                {
                    cout<<max(0, (2*in-n-1))+1<<endl;
                }
                else
                {
                    cout<<r-l+1<<endl;
                }
            }
        }
        else
            cout<<n<<endl;

    }

}