using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input.Split()[0]);
            int q = int.Parse(input.Split()[1]);

            List<int> a, b; //a-glasovi, b-potrebni rezultati,medijane,upiti
            unosulistu(Console.ReadLine(), out a);
            unosulistu(Console.ReadLine(), out b);

            a.Sort();

            foreach (int m in b)
            {
                if (m == a[a.Count - 1] || m == a[0]) Console.WriteLine(a.Count - 1 + ((a.Count%2==0 && a[a.Count-1]==m)?-1:0));
                else 
                    if (m > a[a.Count - 1] || m < a[0]) Console.WriteLine(a.Count );
                else
                {
                    int i = IndexUListi(m, a, 0, a.Count - 1);
                    if (a[a.Count / 2] == m) Console.WriteLine(0); //+1-1 u indexu
                    else
                        Console.WriteLine(Math.Abs(a.Count-(i+1) - i) - 1);
                }
                
            }

            Console.ReadLine();

        }

        static void unosulistu(string inp, out List<int> list)
        {
            list = new List<int>();
            foreach (string s in inp.Split())
                list.Add(int.Parse(s));
        }

        static int IndexUListi(int x, List<int> list, int l, int d) //Pomocu binary search trazi index gde treba ubaciti x tako da lista ostane sortirana
        {
            if (list[(l + d) / 2] == x)
                return (l + d) / 2;
            if (list[l] == x)
                return l;
            if (d-l< 1)
                return d;
            if (list[(l + d) / 2] > x)
                return IndexUListi(x, list, l, (l + d) / 2);
            else
                return IndexUListi(x, list, (l + d) / 2, d);
        }
    }
}