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

namespace ConsoleApp23
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] linija = Console.ReadLine().Split();
            int n = int.Parse(linija[0]);
            int q = int.Parse(linija[1]);
            linija = Console.ReadLine().Split();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(linija[i]);
            }
            Array.Sort(a);
            int medijana = a[n / 2];
            linija = Console.ReadLine().Split();
            int[] b = new int[q];
            for (int i = 0; i < q; i++)
            {
                b[i] = int.Parse(linija[i]);
                if (b[i] == medijana)
                {
                    Console.WriteLine(0);

                }
                else if (b[i] < a[0]) Console.WriteLine(n + 1);
                else if (b[i] > a[n - 1]) Console.WriteLine(n);
                else if (b[i] < medijana)
                {
                    for (int j = n / 2 - 1; j > -1; j--)
                    {
                        if (a[j] == b[i])
                        {
                            Console.WriteLine(n - 1 - 2 * j);
                            break;
                        }
                        if (a[j] < b[i])
                        {
                            Console.WriteLine(n - 1 - 2 * j);
                            break;
                        }
                    }
                }
                else if (b[i] > medijana)
                {
                    for (int j = n / 2+1; j < n; j++)
                    {                        
                            if (a[j] == b[i])
                            {
                                Console.WriteLine(j*2-n);

                                break;
                            }
                            if (a[j] > b[i])
                            {
                                Console.WriteLine(j*2-n);

                                break;
                            }                        
                    }
                }
            }
          
        }
    }
}