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

namespace zad
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]), q = int.Parse(s[1]);
            List<int> a = new List<int>(); List<int>b=new List<int>();
            s = Console.ReadLine().Split();
            for (int i = 0; i < n; i++) a.Add(int.Parse(s[i]));
            s = Console.ReadLine().Split();
            for (int i = 0; i < q; i++) b.Add(int.Parse(s[i]));
            int br;
            int[]a1=a.ToArray();
            for (int i = 0; i < q; i++)
            {
                br = 0;
                a.Sort();
                while (true)
                {
                    if (a[a.Count() / 2] != b[i])
                    {
                        br++;
                        a.Add(b[i]);
                        a.Sort();
                    }
                    else break;
                }
                Console.WriteLine(br);
                a = new List<int>(a1);
            } 
            }
        }
    }