using System;
using System.Text;

namespace Zadaci
{
    class Program
    {
        static int NamestenaMedijana(int[] niz, int broj)
        {
            int resenje = 0;
            Array.Sort(niz);
            int index = Array.BinarySearch(niz, broj);
            int mediana = niz.Length / 2 + 1;
            if (index >= 0)
            {
                resenje =Math.Abs(niz.Length - 1 - 2 * index);
                if ((resenje + niz.Length)%2 !=0 && index > niz.Length /2)
                {
                    resenje--;
                }
            }
            if (index < 0)
            {
                resenje = Math.Abs(niz.Length - 2 * ~index) + 1;
                if ((resenje + niz.Length) % 2 != 0 && ~index > niz.Length / 2)
                {
                    resenje--;
                }
            }
            return resenje;
        }
        static void Main(string[] args)
        {
            string[] temp = Console.ReadLine().Split();
            int n = int.Parse(temp[0]);
            int q = int.Parse(temp[1]);
            temp = Console.ReadLine().Split();
            int[] pocetnaKutija = new int[n];
            for (int i = 0; i < n; i++)
            {
                pocetnaKutija[i] = int.Parse(temp[i]);
            }
            temp = Console.ReadLine().Split();
            int[] slucajevi = new int[q];
            for (int i = 0; i < q; i++)
            {
                slucajevi[i] = int.Parse(temp[i]);
            }
            for (int i = 0; i < q; i++)
            {
                Console.WriteLine(NamestenaMedijana(pocetnaKutija, slucajevi[i]));
            }
        }
    }
}