using System;
					
public class Program
{
    static int provera(int a, int[] b){
		
        if(a>b.Length/2)
        {
            for (int i = a-1; i >= b.Length/2; i--)
            {
                if(b[i]!=b[a]){
                    return i+1;
                }
					
            }
        }
        else if (a<b.Length/2)
        {
            for (int i = a+1; i <=b.Length/2; i++)
            {
                if(b[i]!=b[a]){
                    return i-1;
                }
            }
        }
        return b.Length/2;
    }
    public static void Main()
    {
        string[] data = Console.ReadLine().Split(' ');
        int n = int.Parse(data[0]);
        int q = int.Parse(data[1]);

        int[] a = new int[n];
        int[] b = new int[q];
        data = Console.ReadLine().Split(' ');
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(data[i]);
        }
        data = Console.ReadLine().Split(' ');
        Array.Sort(a);
        int temp = a[a.Length / 2];
        for (int i = 0; i < q; i++)
        {
            int skok = 0;
            int p = int.Parse(data[i]);
            int k = Array.BinarySearch(a, p);
            if (k>=0)
            {
                k = provera(k, a);
                if (k > a.Length / 2)
                {
                    skok = 2 * k - a.Length;
                }
                else if (k < a.Length / 2)
                {
                    skok = a.Length - 2 * k - 1;
                }
            }
            else if (k < 0)
            {
                k = Math.Abs(k) - 1;
                if (k > a.Length / 2)
                {
                    skok = 2 * k - a.Length ;
                }
                else if (k < a.Length / 2 +1)
                {
                    skok = a.Length - 2 * k +1;
                }

            }

            b[i] = skok;
        }

        for (int i = 0; i < q; i++)
        { 
            Console.WriteLine(b[i]);
        }
    }
}