using System;
namespace takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nq = Console.ReadLine().Split();
            int n = Convert.ToInt32(nq[0]);
            int q = Convert.ToInt32(nq[1]);
            string[] s = Console.ReadLine().Split();
            string[] b = Console.ReadLine().Split();
            int[] a = new int[n];
            for (int i = 0; i < a.Length; i++) a[i] = Convert.ToInt32(s[i]);
            Array.Sort(a);
            for (int i = 0; i < q; i++)
            {
                int j = 0;
                int k = 0;
                if (Convert.ToInt32(b[i]) > a[n - 1]) Console.WriteLine(n);
                else if (Convert.ToInt32(b[i]) == a[n - 1]) Console.WriteLine(n - 2);
                else
                {
                    while (Convert.ToInt32(b[i]) >= a[j])
                    {
                        if (Convert.ToInt32(b[i]) == a[j])
                        {
                            k++;
                        }
                        j++;
                    }
                    if (k == 0)
                    {
                        if (n % 2 != 0 & j - 1 == n / 2 || n % 2 == 0 & n - j - 1 == j) Console.WriteLine("1");
                        else if (n % 2 == 0 & j - 1 == n / 2) Console.WriteLine("2");
                        else if (j == 0) Console.WriteLine(n + 1);
                        else if (j == 1) Console.WriteLine(n - 1);
                        else if (n % 2 != 0 & n - j - 1 > j - 1) Console.WriteLine(n - j - 1);
                        else if (n % 2 != 0 & n - j - 1 < j - 1) Console.WriteLine(j - 1);
                        else if (n - j - 1 > j - 1 & n == 4) Console.WriteLine(n - j);
                        else if (n - j - 1 > j - 1) Console.WriteLine(n - j - 1);
                        else Console.WriteLine(j - 1);
                    }
                    else
                    {
                        if (j - 1 == n / 2) Console.WriteLine("0");
                        else if (j == 0) Console.WriteLine(n + 1);
                        else if (j == 1) Console.WriteLine(n - 1);
                        else if (n % 2 != 0 & n - j - 1 > j - 1) Console.WriteLine(n - j - 1);
                        else if (n % 2 != 0 & n - j - 1 < j - 1) Console.WriteLine(n - j);
                        else if (n - j - 1 > j - 1 || j == 2 & n - j - 1 == j - 1) Console.WriteLine(n - j - 1);
                        else if (n - j - 1 == j - 1) Console.WriteLine(n - j - 2);
                        else Console.WriteLine(n - j + 1);
                    }
                }
            }
        }
    }
}