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

namespace ConsoleApp20
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string linija = Console.ReadLine();
            int n =int.Parse( linija.Split(' ')[0]);
            int q =int.Parse( linija.Split(' ')[1]);
           
            linija = Console.ReadLine();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(linija.Split(' ')[i]);
                
            }
            Array.Sort(a);
/*5 4
1 3 5 7 9
5 8 7 10*/
            linija = Console.ReadLine();
            int[] b = new int[q];
            for (int i = 0; i < q; i++)
            {
                b[i] = int.Parse(linija.Split(' ')[i]);
                if (b[i] == a[n / 2])
                {
                    Console.WriteLine(0);
                }
                else if (b[i]<a[0]||b[i]>a[n-i])
                {
                    Console.WriteLine(n);
                }
                else
                {
                    if (b[i] > a[n / 2])
                    {
                        
                        for (int j = n / 2 +1 ; j < n; j++)
                        {
                          
                           
                            if (a[j]>b[i])
                            {
                                Console.WriteLine(j - (n / 2)+1);
                                
                            }
                            else if (a[j] == b[i]) Console.WriteLine(j - (n / 2));
                        }
                    }
                    else
                    {
                        

                        for (int j = n / 2 -1; j > 0; j--)
                        {
                            if (a[j] < b[i])
                            {
                                Console.WriteLine(Math.Abs(j - (n / 2)));
                               
                            }
                            else if (a[j] == b[i]) Console.WriteLine(Math.Abs(j - (n / 2)));
                        }
                    }
                }
            }
          
        }
    }
}