using System;

namespace NamestanjeGlasova
{
    class Program
    {

        static int[] BrGlasova(int[] a, int[] b)
        {
            int[] p = new int[b.Length];
            int med = 0;
            Array.Sort(a);

            // med = a[a.Length / 2 + 1];
            if (a.Length % 2 == 0)
            {
                med = (a[a.Length / 2] + a[a.Length / 2 + 1]) / 2;
            }
            else
            {
                med = a[a.Length / 2];
            }

            for (int i = 0; i < b.Length; i++)
            {
                for (int j = 0; j < a.Length; j++)
                {
                    if (b[i] == med)
                    {
                        p[i] = 0;
                    }
                    else if (b[i] > med)
                    {
                        if (b[i] > a[j])
                        {
                            int c = a.Length + 1;
                            int n = 2 * c - 2;
                            p[i] = n - a.Length;
                        }
                        if (b[i] <= a[j])
                        {
                            int c = j;
                            int n = (2 * c) - 2;
                            p[i] = n - a.Length;
                        }
                    }
                }

            }

            return p;
            // return med;
        }
        static void Main(string[] args)
        {
            string[] p = Console.ReadLine().Split();
            int n = int.Parse(p[0]);
            int q = int.Parse(p[1]);
            string[] s = Console.ReadLine().Split();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
            }

            string[] s1 = Console.ReadLine().Split();
            int[] b = new int[q];
            for (int i = 0; i < q; i++)
            {
                b[i] = int.Parse(s1[i]);
            }
            //Array.Sort(a);
            //Console.WriteLine(BrGlasova(a,b));

            int[] v = BrGlasova(a, b);

            for (int i = 0; i < v.Length; i++)
            {
                Console.WriteLine(v[i]);
            }
            //Console.WriteLine(BrGlasova(a, b));
        }
    }
}