// Welcome to Sin City
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int bp(vector<int> &v, int euro)
{
    int l = 0, r = v.size() - 1;
    int mid;
    while (r - l > 1) 
    {
        int mid = (r + l) / 2;
        if (v[mid] < euro) 
            l = mid + 1;
        else 
            r = mid;
    }
    if (v[l] == euro) 
         return l;
    else if (v[r] == euro) 
        return r;
    else 
        return -1;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int N,Q;
    cin >> N >> Q;
    vector<int> niz_1(N);
    
    for(int i = 0; i < N; i++)
        cin >> niz_1[i];
        
    for(int i = 0; i < Q; i++)
    {
        int _u, br = 0;
        cin >> _u;
        vector<int> niz_2(N);
        niz_2 = niz_1;
        sort(niz_2.begin(), niz_2.end());
        if(_u != niz_2[(niz_2.size()/2)])
        {
            if(bp(niz_2, _u) == -1)
            {
                niz_2.push_back(_u);
                br++;
                sort(niz_2.begin(), niz_2.end());
            }
            int poz = bp(niz_2, _u);
            br += (poz-(niz_2.size()-poz));
        }
        cout << br << "\n";
    }
    return 0;
}