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

namespace a
{
    class Program
    {
        static int binarna(int[] a, int n, int x)
        {
            int m = a[n / 2];
            int l, d, r = 0;
            if (x < a[0]) return n + 1;
            if (x > a[n - 1]) return n;
            if (x == m) return 0;
            if (x < m)
            {
                l = 0;
                d = n / 2 - 1;
            }
            else
            {
                l = n / 2 + 1;
                d = n - 1;
                r = 1;
            }
            int p;
            while (true)
            {
                p = l + (d - l) / 2;
                if (a[p] == x)
                {
                    if (r == 0)
                    {
                        while (a[p + 1] == x) p++;
                    }
                    else
                    {
                        while (a[p - 1] == x) p--;
                    }
                    return Math.Abs(p - (n - p - 1)) - r;
                }
                if (a[p] > x && a[p - 1] < x) return Math.Abs(p - (n - p)) + 1 - r;
                if (x < a[p])
                {
                    d = p - 1;
                }
                else
                {
                    l = p + 1;
                }
            }
        }

        static void Main(string[] args)
        {
            string[] u = Console.ReadLine().Split();
            int n = int.Parse(u[0]);
            int q = int.Parse(u[1]);
            u = Console.ReadLine().Split();
            int[] a = new int[n];
            for(int i = 0; i < n; i++)
            {
                a[i] = int.Parse(u[i]);
            }
            Array.Sort(a);
            u = Console.ReadLine().Split();
            for (int i = 0; i < q; i++)
            {
                int x = int.Parse(u[i]);
                Console.WriteLine(binarna(a, n, x));
            }
        }
    }
}