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

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            string NQ = Console.ReadLine();
            int[] N = new int[int.Parse(NQ.Split(' ')[0])];
            int[] Q = new int[int.Parse(NQ.Split(' ')[1])];
            NQ = Console.ReadLine();
            for (int i = 0; i < N.Length; i++)
            {
                N[i] = int.Parse(NQ.Split(' ')[i]);
            }
            NQ = Console.ReadLine();
            for (int i = 0; i < Q.Length; i++)
            {
                Q[i] = int.Parse(NQ.Split(' ')[i]);
            }
            Array.Sort(N);
            int medijana = N[N.Length/2];


            for (int i = 0; i < Q.Length; i++)
            {
                if (Q[i] == medijana) Console.WriteLine(0);
                else if (Q[i] > N[N.Length - 1])
                {
                    Console.WriteLine(N.Length);
                }
                else if (Q[i] < N[0])
                {
                    Console.WriteLine(N.Length + 1);
                }
                else if (Q[i] > medijana)
                {
                    for (int j = N.Length /2 +1; j < N.Length; j++)
                    {
                        if (N[j] >= Q[i])
                        {
                            Console.WriteLine(Math.Abs(j * 2 - N.Length));
                            break;
                        }
                    }
                }
                else if (Q[i] < medijana)
                {
                    for (int j = N.Length/2-1; j >=0; j--)
                    {
                        if (N[j] <= Q[i])
                        {
                            Console.WriteLine(Math.Abs(N.Length - 1 - 2 * j));
                            break;
                        }
                    }
                }
            }
        }
    }
}