using System;
using System.Linq;

namespace P_2022_1_2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] be1 = Console.ReadLine().Split(' ').ToArray();
            int[] a = new int[2];
            for (int i = 0; i < 2; i++)
                a[i] = int.Parse(be1[i]);
            string[] be2 = Console.ReadLine().Split(' ').ToArray();
            int[] b = new int[a[0]];
            for (int i = 0; i < a[0]; i++)
                b[i] = int.Parse(be2[i]);
            string[] be3 = Console.ReadLine().Split(' ').ToArray();
            int[] c = new int[a[1]];
            for (int i = 0; i < a[1]; i++)
                c[i] = int.Parse(be3[i]);
            int[] eredmeny = new int[a[1]];
            Array.Sort(b);
            int max = b[b.Length - 1];
            int seged = 0;
            for (int i = 0; i < a[1]; i++)
            {
                Array.Sort(b);
                if (Array.BinarySearch(b, c[i]) > 0)
                {
                    while (b[b.Length / 2 + seged] != c[i])
                    {
                        Array.Resize(ref b, b.Length + 1);
                        b[b.Length - 1] = c[i];
                        eredmeny[i]++;
                        Array.Sort(b);
                    }
                }
                else if (Array.BinarySearch(b, c[i]) < 0)
                {
                    Array.Resize(ref b, b.Length + 1);
                    b[b.Length - 1] = c[i];
                    eredmeny[i]++;
                    Array.Sort(b);
                    while (b[b.Length / 2 + seged] != c[i])
                    {
                        Array.Resize(ref b, b.Length + 1);
                        b[b.Length - 1] = c[i];
                        eredmeny[i]++;
                        Array.Sort(b);
                    }
                }
            }
            foreach (int i in eredmeny)
                Console.WriteLine(i);
        }
    }
}