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

namespace aaa
{ 

    class Program
    {
        public static void Main()
        {
            int[] x= Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] a=Console.ReadLine().Split(' ').Take(x[0]).Select(int.Parse).ToArray();
            int[] b = Console.ReadLine().Split(' ').Take(x[1]).Select(int.Parse).ToArray();


            Array.Sort(a);
            int mer = a.Length / 2;
            for (int i = 0; i < b.Length; i++)
            {
                if (Array.IndexOf(a, b[i])!=-1)
                {
                    int index= Array.IndexOf(a, b[i]);
                    int answ;
                    if (index > mer)
                        answ = index - 1 - (a.Length - 1 - index);

                    else if (index == mer)
                        answ = 0;
                    else
                        answ = (a.Length - 1 - index) - index;
                    Console.Write(answ + " ");
                }
                else
                {
                    a= a.Append(b[i]).ToArray();
                    Array.Sort(a);
                    mer = a.Length / 2;
                    int index = Array.IndexOf(a, b[i]);
                    int answ;
                    if (index > mer)
                        answ = index - 1 - (a.Length - 1 - index);

                    else if (index == mer)
                        answ = 0;
                    else
                        answ = (a.Length - 1 - index) - index;

                    Console.Write(answ+1 + " ");
                }
            }
        }
        
    }
}