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

namespace ConsoleApp13
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] pred = Console.ReadLine().Split(' ');
            string[] dred = Console.ReadLine().Split(' ');
            string[] tred = Console.ReadLine().Split(' ');
            int n = int.Parse(pred[0]);
            int q = int.Parse(pred[1]);
            int[] a = Array.ConvertAll(dred, int.Parse);
            Array.Sort(a);
            int[] b = Array.ConvertAll(tred, int.Parse);
            int medijana = a.Length / 2;
            int maksi = n - 1;
            string res = "";


            for (int i = 0; i < b.Length; i++)
            {
                int x = b[i];
                int indeks = Array.BinarySearch(a, x);
                int rez = 0;
                if (indeks > 0)
                {
                    int n2 = indeks * 2 - indeks % 2;
                    rez = Math.Abs(maksi - n2);
                    if (indeks < n / 2  && indeks % 2 == 1) rez--;
                    else if ((indeks == n / 2) && (n % 2 == 0)) rez--;
                    res += rez.ToString() + Environment.NewLine;
                }
                else if (indeks < 0)
                {
                    n++;
                    Array.Resize<int>(ref a, n);
                    a[n - 1] = x;
                    Array.Sort(a);
                    indeks = Array.BinarySearch(a, x);
                    int n2 = indeks * 2 - indeks % 2;
                    rez = Math.Abs(maksi - n2);
                    if (indeks < n / 2 &&  indeks % 2 == 1) rez--;
                    else if ((indeks == n / 2) && (n % 2 == 0)) rez--;
                    res += rez.ToString() + Environment.NewLine;
                }
                else
                {
                    rez = n - 1;
                    res += rez.ToString() + Environment.NewLine;
                }


            }
            Console.WriteLine(res);
            Console.Read();
        }
    }
}