using System;

namespace TAKMICENJE_1_2_NAMESTANJE_GLASANJA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            long n = long.Parse(unos[0]), q = long.Parse(unos[1]);
            unos = Console.ReadLine().Split();
            long[] a = new long[n];
            long[] b = new long[q];
            long[] resenja = new long[q];
            for (int i = 0; i < n; i++)
                a[i] = long.Parse(unos[i]);
            unos = Console.ReadLine().Split();
            for (int i = 0; i < q; i++)
                b[i] = long.Parse(unos[i]);
            Array.Sort(a);
            for (int i = 0; i < q; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (a[j] <= b[i])
                    {
                        if (j % 2 == 0)
                        {
                            //if (j == n - 1)
                                //resenja[i] = n;
                            if (a[j] == b[i])
                            {
                                if (j == n / 2)
                                    resenja[i] = 0;
                                else
                                    resenja[i] = Math.Abs(j - Math.Abs(n - j - 1)) - 1;
                                break;
                            }

                            else if (j == n - 1)
                                resenja[i] = n;
                        }
                        else if (j % 2 != 0)
                        {

                            //if (j == n - 1)
                               // resenja[i] = n + 1;
                            if (a[j] == b[i])
                            {
                                if (j == n / 2 + 1)
                                {
                                    resenja[i] = 1;
                                    Console.WriteLine("ovde");
                                }
                                else
                                {
                                    resenja[i] = Math.Abs(j - Math.Abs(n - j - 1));
                                    Console.WriteLine("ipak je ovde");
                                }
                                break;
                            }
                            else if (j == n - 1)
                                resenja[i] = n - 1;
                        }
                        //if (j == n - 1)
                            //resenja[i] = n + 2;
                    }
                    else
                    {
                        //resenja[i] = Math.Abs(j - Math.Abs(n - j - 1));
                        if (j == n / 2)
                            resenja[i] = 1;
                        if (j < n / 2)
                            resenja[i] = n - j;
                        if (j > n / 2)
                            resenja[i] = 2 * j - n;
                        break;
                    }
                }
            }
            foreach (var x in resenja)
            {
                Console.WriteLine(x);
            }
        }
    }
}