using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;
namespace ConsoleApp4
{
    internal class Program
    {


        static void Sort(int[] a, int n)
        {
            int i, j, k;
            for (i = 0; i < n - 1; i++)
                for (j = i + 1; j < n; j++)
                    if (a[i] > a[j])
                    {
                        k = a[i];
                        a[i] = a[i + 1];
                        a[i + 1] = k;
                    }

        }


        private static void Main(string[] args)
        {
            bool p = true;
            int br = 0, i,k;
            string s = Console.ReadLine();
            string[] s1 = s.Split(' ');
            int n = int.Parse(s1[0]);
            int m = int.Parse(s1[1]);
            int[] a = new int[n * 2 + 2];
            int[] b = new int[m];
            s = Console.ReadLine();
            s1 = s.Split(' ');
            for (i = 0; i < n; i++)
                a[i] = int.Parse(s1[i]);
            s = Console.ReadLine();
            string[] s2 = s.Split(' ');
            for (i = 0; i < m; i++)
                b[i] = int.Parse(s2[i]);
            Sort(a, n);
            for(int j =0;j<m;j++)
            {
                if (b[j] == a[n / 2])
                    Console.WriteLine(br);
                else if ((b[j] > a[n / 2]))
                {
                    for (i = n / 2; i < n && p; i++)
                    {
                        if (a[i] == b[j])
                        {
                            p = false;
                        }
                        br++;
                    }
                    if (p == false)
                        Console.WriteLine(br-1);
                    else
                        Console.WriteLine(n);

                }
                else if ((b[j] < a[n / 2]))
                {
                    for (i = n / 2; i >= 0 && p; i--)
                    {
                        if (a[i] == b[j])
                        {
                            p = false;
                        }
                        br++;
                    }
                    if (p == false)
                        Console.WriteLine(br-1);
                    else
                        Console.WriteLine(n);

                }
                br = 0;
                p = true;
            }
            

        }
    }
}