using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TakmicenjeZad2
{
    internal class Program
    {

        static void SortList(ref List<int> niz) // bubble sort
        {
            int temp;
            for (int i = 0; i < niz.Count; i++)
            {
                for (int j = 0; j < niz.Count - 1; j++)
                {
                    if (niz[j] > niz[j + 1])
                    {
                        temp = niz[j + 1];
                        niz[j + 1] = niz[j];
                        niz[j] = temp;
                    }
                }
            }
        }

        static void SortNiz(ref int[] niz) // bubble sort
        {
            int temp;
            for (int i = 0; i < niz.Length; i++)
            {
                for (int j = 0; j < niz.Length - 1; j++)
                {
                    if (niz[j] > niz[j + 1])
                    {
                        temp = niz[j + 1];
                        niz[j + 1] = niz[j];
                        niz[j] = temp;
                    }
                }
            }
        }

        static void Main(string[] args)
        {
            string[] br = Console.ReadLine().Split(' ');
            int brElem = Convert.ToInt32(br[0]); // N
            int brMed = Convert.ToInt32(br[1]); // Q

            string[] elemStr = Console.ReadLine().Split(' ');
            string[] medStr = Console.ReadLine().Split(' ');

            List<int> nizElem = new List<int>(); // niz sa elementima
            int[] nizSave = new int[brElem];
            int[] nizMed = new int[brMed]; // niz sa slucajevima

            for(int i = 0; i < brElem; i++)
            {
                nizElem.Add(Convert.ToInt32(elemStr[i]));
                nizSave[i] = nizElem[i];
            }

            for (int i = 0; i < brMed; i++)
            {
                nizMed[i] = Convert.ToInt32(medStr[i]);
            }    

            SortNiz(ref nizSave);

            int trenutnaMed;
            int brojac;
            for(int i = 0; i < brMed; i++)
            {
                brojac = 0;
                trenutnaMed = nizElem[nizElem.Count / 2];
                nizElem = nizSave.ToList();

                while (trenutnaMed != nizMed[i])
                {
                    nizElem.Add(nizMed[i]);
                    SortList(ref nizElem);
                    trenutnaMed = nizElem[nizElem.Count / 2];
                    brojac++;

                }
                Console.WriteLine(brojac);
            }
        }
    }
}