#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int n,a,b,br=0;cin>>n>>a;int arr[n],arr1[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    copy (arr, arr+n, arr1);
    sort(arr, arr+n);
    for (int i=0;i<a;i++){
        cin>>b;
        int x=arr[(n+br)/2];
        if(b==x){cout<<0<<endl;}
        while(b>x){
            //if(b==x){cout<<br<<"JES"<<endl;break;}
            arr[n+br+i]=b;
            x=arr[(n+br+i)/2];
            sort(arr,arr+n+br+i);
            br++;
        }
        if((n+br)%2==1){cout<<br-1<<endl;}
        else if(((n+br)%2==0)){cout<<br<<endl;}
       /* while(b<x){
            //if(b==x){cout<<br<<"JES"<<endl;break;}
            arr[n+br+i]=b;
            x=arr[(n+br+i)/2];
            sort(arr,arr+n+br+i);
            br++;
        }*/
        br=0;
    }
    return 0;
}