using System;
namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int N = int.Parse(s[0]);
            int Q = int.Parse(s[1]);
            int[] A=new int[N], B=new int[Q];
            s = Console.ReadLine().Split();
            for (int i = 0; i < N; i++)
                A[i] = int.Parse(s[i]);
            s = Console.ReadLine().Split();
            for (int i = 0; i < Q; i++)
                B[i] = int.Parse(s[i]);
            Array.Sort(A);
            for (int i = 0; i < Q; i++)
            {
                if (A[A.Length / 2] == B[i])  Console.WriteLine("0");
                else
                {
                    if (A[A.Length / 2] > B[i])
                    {
                        int a = SEARCHB(A,B[i]);
                        if (a!=-1)
                            Console.WriteLine(A.Length-2*a-1);
                        else
                        {
                            int[] arr = new int[A.Length + 1];
                            bool pom = true;
                            for (int j = 0; j < A.Length; j++)
                            {
                                if (B[i] < A[j] && pom) { arr[j] = B[i]; pom = false; a = j; }
                                if (!pom) arr[j + 1] = A[j];
                                else arr[j] = A[j];
                            }
                            if (pom) { arr[A.Length] = B[i]; a = A.Length; }
                            Console.WriteLine(arr.Length - 2 * a);
                        }
                    }
                    else
                    {
                        int a = SEARCHS(A, B[i]);
                        if (a != -1)
                            Console.WriteLine(2 * a - A.Length);
                        else
                        {
                            int[] arr = new int[A.Length + 1];
                            bool pom = true;
                            for (int j = 0; j < A.Length; j++)
                            {
                                if (B[i] < A[j] && pom) { arr[j] = B[i]; pom = false; a = j; }
                                if (!pom) arr[j + 1] = A[j];
                                else arr[j] = A[j];
                            }
                            if (pom) { arr[A.Length] = B[i]; a = A.Length; }
                            Console.WriteLine(2 * a - arr.Length+1);
                        }
                    }
                    
                }
            }
        }
        static int SEARCHB(int[] a, int x)
        {
            for (int i = a.Length / 2-1; i >= 0; i--)
                if (a[i] == x) return i;
            return -1;
        }
        static int SEARCHS(int[] a, int x)
        {
            for (int i = a.Length / 2+1; i<a.Length; i++)
                if (a[i] == x) return i;
            return -1;
        }
    }
}