using System;
using System.Collections.Generic;

namespace Takmicenje___2022_11_19
{
    internal class Program
    {
        static int Medijana(List<int> niz)
        {
            niz.Sort();
            return niz[niz.Count/2];
        }
        static List<int> DeepCopy(List<int> niz)
        {
            List<int> list = new List<int>();
            foreach (var item in niz)
            {
                list.Add(item);
            }
            return list;
        }
        static void drugi()
        {
            string[] temp = Console.ReadLine().Trim().Split();
            int n = int.Parse(temp[0]);
            int q = int.Parse(temp[1]);
            List<int> a = new List<int>();
            List<int> kopija = new List<int>();
            List<int> b = new List<int>();
            temp = Console.ReadLine().Trim().Split();
            for (int i = 0; i < n; i++)
            {
                a.Add(int.Parse(temp[i]));
                kopija.Add(int.Parse(temp[i]));
            }
            temp = Console.ReadLine().Trim().Split();
            for (int i = 0; i < q; i++)
            {
                b.Add(int.Parse(temp[i]));
            }
            
            foreach (var item in b)
            {
                int brojac = 0;
                while (Medijana(kopija) != item)
                {
                    kopija.Add(item);
                    brojac++;
                }
                Console.WriteLine(brojac);
                kopija = DeepCopy(a);
            }
        }
        static void Main(string[] args)
        {
            drugi();
        }
    }
}