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

namespace ivonaaaaa
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n, q;
            n = int.Parse(Console.ReadLine());
            q = int.Parse(Console.ReadLine());
            List<int> a = new List<int>();
            List<int> b = new List<int>();
            List<int> r = new List<int>();

            for (int i = 0; i < n; i++)
            {
                int x = int.Parse(Console.ReadLine());
                a.Add(x);

            }
            for (int i = 0; i < q; i++)
            {
                int x = int.Parse(Console.ReadLine());
                b.Add(x);

            }
            a.Sort();

            int br = 0;
            int m = 0;
            int rez = 0;
            for (int j = 0; j < b.Count; j++)
            {
               

                    if (n % 2 == 0) while (b[j] != m)
                    {
                        int vr1 = a[(n / 2) - 1];
                        int vr2 = a[(n / 2)];
                        m = (vr1 + vr2) / 2;
                        a.Add(n);
                        n++;
                        a.Sort();
                        br++;
                        if (br < 10) rez = 1;
                        else
                        {
                            br %= 10;
                            rez++;
                            while (br != 0)
                            {
                                br -= 10;
                                rez++;
                            }
                        }
                    }

                if (n % 2 == 1)
                {
                    m = a[(n / 2)];
                    while (b[j] != m)
                    {
                        m = a[(n / 2)];
                        a.Add(n);
                        n++;
                        a.Sort();
                        br++;
                        if (br < 10) rez = 1;
                        else
                        {
                            br %= 10;
                            rez++;
                            while (br != 0)
                            {
                                br -= 10;
                                rez++;
                            }

                        }


                    }
                }
                    r.Add(rez);
                
     
            }
            foreach(int i in r)Console.WriteLine(i);
            Console.ReadKey();
        }
    }
}