#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

double Medijana(double n)
{
    return n / 2;
}
bool Postoji(int* arr, int n, int target)
{
    //sort(arr, arr + n);
    return binary_search(arr, arr + n, target);
}

int funkcija(int *arr,int n,int target,int mid)
{

    int br = 0;
    if (mid == target)
        return br;

    if (mid < target)
    {
        if (!Postoji(arr,n,target))
        {
            arr[n] = target;
            n++;
            sort(arr, arr + n);
            if (mid != arr[n / 2])
                br++;
        }
        
    }
    else if (target < mid)
    {
        if (!Postoji(arr, n, target))
        {
            arr[n] = target;
            n++;
            sort(arr, arr + n);
        }
        else
        {
            br--;
        }
    }
    int index = find(arr, n + arr, target) - arr;
    br += abs(index - Medijana(n)) * 2;

    return br;
}

int main()
{
    int N, Q;
    cin >> N >> Q;
    int* A = new int[N+1];
    for (size_t i = 0; i < N; i++)
    {
        int t;
        cin >> t;
        A[i] = t;
    }
    int mid = A[N / 2];
    for (size_t i = 0; i < Q; i++)
    {
        int b;
        cin >> b;
        int* B = new int[N+1];
        copy(A, A + N, B);
        cout << funkcija(B, N, b,mid)<<"\n";
    }
}