using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NamestanjeGlasanja
{
    class Program
    {
        static double medijana(int[] a)
        {
            Array.Sort(a);
            if (a.Length % 2 != 0)
                return a[a.Length / 2];
            else
                return ((double)a[a.Length / 2 - 1] +
                        (double)a[a.Length / 2]) / 2.0;
        }
        static bool postojiUNizu(int[] a, int x)
        {
            for (int i = 0; i < a.Length; i++)
                if (x == a[i])
                    return true;
            return false;
        }
        static int prviManji(int[] a, int x)
        {
            for (int i = 1; i < a.Length; i++)
            {
                if (x < a[i])
                    return i - 1;
            }
            return a.Length;
        }
        static void glasanje(int[] a, int[] b)
        {
            int n = a.Length;
            int q = b.Length;
            double med = medijana(a);
            for (int i = 0; i < q; i++)
            {
                int br = 0;
                if (b[i] == med)
                    Console.WriteLine(br);
                else
                {
                    bool postoji = postojiUNizu(a, b[i]);
                    if (postoji)
                    {
                        for (int j = n / 2; j < n; j++)
                        {
                            if (a[j] == b[i])
                            {
                                br = j;
                                j = n;
                            }
                        }
                        Console.WriteLine(br - (n - 1 - br));
                    }
                    else
                    {
                        Console.WriteLine(prviManji(a, b[i]) - (n - 1 - (prviManji(a, b[i]) + 1)));
                    }
                }
            }
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int q = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int[] a = new int[n];
            int[] b = new int[q];
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(s[i]);
            Array.Sort(a);
            s = Console.ReadLine().Split();
            for (int i = 0; i < q; i++)
                b[i] = int.Parse(s[i]);

            glasanje(a, b);
        }
    }
}