using System;

namespace Takmicenje2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] st = Console.ReadLine().Split();
            int n = int.Parse(st[0]);
            int q = int.Parse(st[1]);
            int[] a = new int[n];
            int[] b = new int[q];

            st = Console.ReadLine().Split();
            for (int i = 0; i < n; i++) a[i] = int.Parse(st[i]);
            Array.Sort(a);

            st = Console.ReadLine().Split();
            for (int i = 0; i < q; i++) b[i] = int.Parse(st[i]);
            Array.Sort(b);
            int br = 0;
            for (int i = 0; i < n; i++)
            {
                int c;
                if (br >= q) break;
                else c = b[br];
                if (c <= a[i])
                {
                    if (i < n / 2 && a[i] == c) c=c;
                    else
                    {
                        int r = 0;
                        if (c == a[n / 2]) r = 0;
                        else if (i <= n / 2) r = n - 2 * i + 1;
                        else r = 2 * i - n;
                        Console.WriteLine(r);
                        br++;
                        i--;
                    }
                }
            }
            for (int i = br; i < q; i++) Console.WriteLine(n);
        }
    }
}