using System;
using System.Linq;

namespace NamestanjeGlasanja
{
    internal class Program
    {
        static void Main(string[] args)
        {
            long[] row1 = getUnos();

            long n = row1[0];
            long q = row1[1];

            long[] a = getUnos();

            long[] b = getUnos();

            Array.Sort(a);

            long median;

            if(n / 2 == 0) {
                median = (n / 2) + 1;
            }else {
                median = a[(n / 2)];
            }

            for(long i = 0; i < q; i++) {
                if(median == b[i]) {
                    System.Console.WriteLine(0);
                }else {
                    long[] newArr = new long[a.Length];
                    Array.Copy(a, newArr, a.Length);

                    long indx = Array.IndexOf(newArr, b[i]);
                    long res = 0;
                    if(indx == -1) {
                        Array.Resize(ref newArr, newArr.Length+1);
                        newArr[newArr.Length-1] = b[i];
                        Array.Sort(newArr);
                        indx = Array.IndexOf(newArr, b[i]);
                        res++;
                    }
                    res += Math.Abs((newArr.Length - indx) - indx);
                    if((res + newArr.Length) % 2 == 0 && indx < newArr.Length / 2) {
                        System.Console.WriteLine(res - 1);
                    }else {
                        System.Console.WriteLine(res);
                    }
                }
            }
        }

        static long[] getUnos() {
            return Console
                .ReadLine()
                .Split(new Char[] {' '}, StringSplitOptions.RemoveEmptyEntries)
                .Select(item => long.Parse(item))
                .ToArray();
        }
    }
}