#include <iostream>
#include <vector>
#include <algorithm>
#define f(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
    int n,q; cin>>n>>q;
    vector<int> a(n);
    vector<int> b(q);
    f(i,n) cin>>a[i];
    f(i,q) cin>>b[i];
    sort(a.begin(),a.end());

    int med;
    if(n%2==0) med = a[n/2+1];
    else med = a[n/2];

    for(int j=0;j<q;j++)
    {
        if(med == b[j]) cout<<0<<endl;
        else if(b[j]>a[n-1]) cout<<n<<endl;
        else if(b[j]<a[0]) cout<<n+1<<endl;
        else{
            vector<int> aa(n);
            bool ima=false;
            f(i,n){
                 aa[i] = a[i];
                 if(a[i]==b[j]) ima=true;
            }
            if(ima==false) aa.push_back(b[j]);
            sort(aa.begin(),aa.end());
            int ind;
            f(i,aa.size()){
                if(aa[i]==b[j])
                {
                    ind=i;
                }
            }
            int k=1;
            if(b[j]<med) k = 2;
            if(n%2==0) cout<<abs(abs(ind-(n/2+1))*k-1)<<endl;
            else cout<<abs(ind-(n/2))*k<<endl;
        }
    }
    return 0;
}