using System;
using System.Collections.Generic;

namespace ConsoleApp2
{

    class Program
    {
        static int medijana(List<int> a, int bi)
        {
            int brojac = 0;
            bool manji = true;
            if (!a.Contains(bi))
            {
                a.Add(bi);
                a.Sort();
                brojac++;
            }
            if (bi > a[a.Count / 2]) manji = false;
            while(a[a.Count/2] != bi)
            {
                if (manji) a.Insert(0, bi);
                else a.Add(bi);
                brojac++;
            }
            for (int i = 0; i < brojac; i++) a.Remove(bi);
            return brojac;
        }
        static void Main(string[] args)
        {
            string[] unos1 = Console.ReadLine().Split();
            int n = Convert.ToInt32(unos1[0]);
            int q = Convert.ToInt32(unos1[1]);
            List<int> a = new List<int>();
            string[] unos2 = Console.ReadLine().Split();
            for (int i = 0; i < n; i++) a.Add(Convert.ToInt32(unos2[i]));
            a.Sort();
            int[] rezultat = new int[q];
            string[] unos3 = Console.ReadLine().Split();
            for (int i = 0; i < q; i++)
            {
                rezultat[i] = medijana(a, Convert.ToInt32(unos3[i]));
            }
            foreach (int x in rezultat) Console.WriteLine(x);
        }
    }
}