using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, q;
            string[] s = Console.ReadLine().Split();
            n = int.Parse(s[0]);
            q = int.Parse(s[1]);
            int[] a = new int[n];
            int[] b = new int[q];
            s = Console.ReadLine().Split();
            for (int i = 0; i < s.Length; i++)
                a[i] = int.Parse(s[i]);
            s = Console.ReadLine().Split();
            for (int i = 0; i < s.Length; i++)
                b[i] = int.Parse(s[i]);
            Array.Sort(a);
            for(int i = 0; i < b.Length; i++)
            {
                int brGlasova = 0;
                n = a.Length;
                if (b[i] != a[n / 2])
                {
                    int indeksB = 0;
                    if (b[i] > a[n - 1]) indeksB = a.Length;
                    for(int j = 0; j < a.Length-1; j++)
                    {
                        if (j < n / 2 && b[i] >= a[j] && b[i] <= a[j + 1]) indeksB=j+1;
                        if (j >= n / 2 && b[i] > a[j] && b[i] <= a[j + 1]) indeksB = j + 1;
                    }
                    if (indeksB < n / 2) brGlasova += 2;
                    while (indeksB != n / 2)
                    {
                        brGlasova++;
                        n++;
                        if (indeksB < n / 2) indeksB++;
                    }
                }
                Console.WriteLine(brGlasova);
            }
        }
    }
}