using System;
using System.Collections.Generic;

namespace Takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] c = Console.ReadLine().Split(" ");
            int N = int.Parse(c[0]);
            int Q = int.Parse(c[1]);

            c = Console.ReadLine().Split(" ");
            int[] A = new int[N];
            for (int i = 0; i < c.Length; i++)
                A[i] = int.Parse(c[i]);

            c = Console.ReadLine().Split(" ");
            int[] B = new int[Q];
            for (int i = 0; i < c.Length; i++)
                B[i] = int.Parse(c[i]);

            int medi;
            Array.Sort(A);
            medi = A[N / 2];
            List<int> IstoKaoA = new List<int>();

            

            int[] glasovi = new int[Q];

            Console.WriteLine();
            for (int i = 0; i < Q; i++)
            {
                if (B[i] == medi) glasovi[i] = 0;
                else
                {
                    foreach (var item in A)
                        IstoKaoA.Add(item);

                    if (IstoKaoA.Contains(B[i]))
                        glasovi[i] = Math.Abs(IstoKaoA.IndexOf(B[i]) * 2 - N);
                    else
                    {
                        IstoKaoA.Add(B[i]);
                        IstoKaoA.Sort();
                        glasovi[i] = Math.Abs(IstoKaoA.IndexOf(B[i]) * 2 - N);
                    }

                    IstoKaoA.Clear();
                }
            }

            foreach (var item in glasovi)
            {
                Console.WriteLine(item);
            }
        }
    }
}