using System;
using System.Collections.Generic;

namespace NAMESTANJE_GLASANJA
{
    class Program
    {
        static int pronadji_poziciju(List<Int64> list, Int64 el, ref Int64 n)
        {
            int l = 0, d = list.Count - 1;
            if (el < list[l])
            { n++; return 0; }
            if (el > list[d])
            { n++; return ++d; }
            while (l != d - 1)
            {
                int p = l + (d - l) / 2;
                if (el < list[p])
                    d = p;
                else if (el > list[p])
                    l = p;
                else return p;
            }
            n++;
            return l + 1;
        }
        static void Main(string[] args)
        {
            string[] u = Console.ReadLine().Split();
            Int64 n = Int64.Parse(u[0]);
            Int64 q = Int64.Parse(u[1]);
            string[] u1 = Console.ReadLine().Split();
            List<Int64> l = new List<Int64>((int)n);
            for (Int64 i = 0; i < n; i++)
                l.Add(Int64.Parse(u1[i]));
            l.Sort();
            string[] u2 = Console.ReadLine().Split();

            for(Int64 i = 0; i < q; i++)
            {
                Int64 el = Int64.Parse(u2[i]);
                Int64 n1 = n;
                int p = pronadji_poziciju(l, el, ref n1) + 1;
                Int64 m = n1 / 2 + 1;

                Int64 resenje = 2*Math.Abs(m - p);
                if (n1 != n)
                    resenje++;
                if (n1 % 2 == 0 && p < m || n1 % 2 == 1 && p > m)
                    resenje -= 1;
                Console.WriteLine(resenje);
            }
        }
    }
}