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

class Program
{
    static int Kolko_Do_Medijane(List<int>  a, int x)
    {
        int br1 = 0;
        int br2 = 0;
        int i;
        if(a[a.Count / 2] == x)
        {
            return 0;
        }
        else if(x > a.Last())
        {
            return a.Count;
        }
        else if(x<a.First())
        {
            return a.Count + 1;
        }



        while (br1<a.Count && a[br1]<x)
        {
            br1++;
        }
        if(br1<(a.Count/2))
        {
            while(a[br1+1]==x)
            {
                br1++;
            }
        }
        if(a[br1]==x)
        {
            i = br1 + 1;
        }
        else
        {
            i = br1;
        }
        while (i < a.Count)
        {
            br2++;
            i++;
        }
        




        if(br1>br2)
        {
            if(a.Contains(x))
            {
                return br1 - (br2 + 1);
            }
            else
            {
                return br1 - (br2 + 1)+1;
            }
        }
        else
        {
            if (a.Contains(x))
            {
                return br2 - br1;
            }
            else
            {
                return br2 - br1+1;
            }
        }

    }
    static void Main(string[] args)
    {
        var s1 = Console.ReadLine().Split();
        int n = int.Parse(s1[0]);
        int q = int.Parse(s1[1]);

        var s2 = Console.ReadLine().Split();
        List<int> a = new List<int>();
        for (int i =0;i<n;i++)
        {
            a.Add(int.Parse(s2[i]));
        }

        a.Sort();


        var s3 = Console.ReadLine().Split();
        List<int> b = new List<int>();
        for (int j = 0; j < q; j++)
        {
            b.Add(int.Parse(s3[j]));
        }


        for(int j = 0;j<q;j++)
        {
            Console.WriteLine(Kolko_Do_Medijane(a,b[j]));
        }
    }
}