#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int MinNumber(int a[],int n, int x){

    sort(a, a+n);
    int k;
    for(k = 0; a[(n)/2] != x; k++){
        a[n++] = x;
        sort(a,a+n);

    }
    return k;

}


int main()
{
    int n,q;
    cin >> n >> q;
    int a[n];
    int b[q];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i<q;i++){
        cin>>b[i];
    }
    sort(a, a+n);
    int resarr[q]  = {0};
    int medianindex = floor(n/2)+1;
    for(int i = 0; i < q; i++){

       cout << MinNumber(a, n, b[i]) << '\n';
        /*if(a[medianindex] == b[i])
            continue;
        else{
            if(b[i] > a[n-1])
                resarr[i] = n;
            else{
                if(b[i] < a[0])
                    resarr[i] = n+1;
                else{
                    if()
                }
            }
        }*/

    }


    return 0;
}