#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;

#pragma warning(disable : 4996)

int main()
{
    int n, q, sklj;
    scanf("%d", &n);
    scanf("%d", &q);
    vector<int> a;
    vector<int> b;
    for (int i = 0; i < n; i++)
    {
        cin >> sklj;
        a.push_back(sklj);
    }
    for (int i = 0; i < q; i++)
    {
        cin >> sklj;
        b.push_back(sklj);
    }
    sort(a.begin(), a.end());
    int x;
    x = a[n / 2];
    vector<int> c = a;
    int k = 0;
    for (int i = 0; i < q; i++)
    {

        a = c;
        x = a[n / 2];
        k = 0;
        if (b[i] < x)
        {
            do
            {
                k++;
                a.insert(a.begin(), b[i]);
                x = a[a.size() / 2];
            } while (x != b[i]);
        }
        else if(b[i] > x)
        {
            do
            {
                k++;
                a.push_back(b[i]);
                x = a[a.size() / 2];
            } while (x != b[i]);
        }
        else
        {
            k = 0;
        }
        printf("%d \n", k);
    }
}