using System;
namespace Namestanje_glasanja
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] NQ=Console.ReadLine().Split();
            string[] Astring = Console.ReadLine().Split();
            string[] Bstring = Console.ReadLine().Split();
            int N = int.Parse(NQ[0]);
            int Q = int.Parse(NQ[1]);
            int[] A = new int[N];
            int[] B = new int[Q];
            int medijana=(N/2);
            for(int i = 0; i < N; i++)
            {
                A[i] = int.Parse(Astring[i]);
            }
            for(int i = 0; i < Q; i++)
            {
                B[i] = int.Parse(Bstring[i]);
            }
       Array.Sort(A);
            for (int i = 0; i < Q; i++)
            {
                if (B[i] == A[medijana]) Console.WriteLine("0");
                else
                {
                    for (int j = 0; j < N-1; j++)
                    {
                        if (B[i] >= A[j] && B[i] < A[j + 1]) Console.WriteLine(Math.Abs(medijana - j));
                    }
                    if (B[i] < A[0] || B[i] > A[N - 1]) Console.WriteLine(N);
                }
            }
            
        }
    }
}