using System;

namespace ConsoleApp8
{
    internal class Program
    {
        static int[] a = new int[100];
        static int br = 0;
        static int d = 0;
        static void kopiraj(int[] niz,int N)
        { 
            Array.Clear(a, 0, a.Length);
            Array.Copy(niz,a,N);
            bubbleSort(a, N);
            d = N;
            br = 0;
        }
        static void bubbleSort(int[] niz, int n)
        {
            for (int i = 0; i < n - 1; i++)
                for (int j = 0; j < n - i - 1; j++)
                    if (niz[j] > niz[j + 1])
                    {
                        int temp = niz[j];
                        niz[j] = niz[j + 1];
                        niz[j + 1] = temp;
                    }
        }
        static void Main(string[] args)
        {
            int N, Q;
            string[] s=Console.ReadLine().Split(' ');
            N=int.Parse(s[0]);
            Q=int.Parse(s[1]);
            s=Console.ReadLine().Split(' ');
            int[] niz = new int[N];
            for (int i = 0; i < N; i++)
            {
                niz[i] = int.Parse(s[i]);
            }
            int[] q = new int[Q];
            s=Console.ReadLine().Split(' ');
            for (int i = 0; i < Q; i++)
            { 
            q[i]=int.Parse(s[i]);
            }
            kopiraj(niz,N);int j = 0;
            int medijan = 0;
            while (j<Q)
            {
                kopiraj(niz, N);
                medijan = niz[N / 2];
                while (medijan!=q[j])
                {
                    a[d] = q[j];
                    br++;
                    d++;
                    bubbleSort(a, d);
                    medijan = a[d / 2];
                }
                Console.WriteLine(br);
                j++;

            }
        }
    }
}