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

namespace zad2k1
{
    internal class Program
    {
        static int resi(int[]niz,int br)
        {
            int a = niz.Length, b=0;
            if (a % 2 == 0)
            {
                b = a / 2 + 1;
            }
            else
            {
                b = (a + 1) / 2;
            }
            b--;
            if (br > niz[a - 1] || br < niz[0])
            {
                if (br > niz[a - 1])
                    return a;
                return a + 1;
            }
            else
            {
                if (niz[b] == br)
                {
                    return 0;
                }
                else
                {
                    if (niz[b] > br)
                    {
                        if (a % 2 == 0)
                            return 2 * pretraga(niz, 1, b, br) + 1;
                        else
                            return 2 * (pretraga(niz, 1, b, br) + 1);
                    }                   
                    else
                    {
                        if(a%2==0)
                            return 2 * (pretraga(niz, -1, b, br) + 1);
                        else
                            return 2 * pretraga(niz, -1, b, br) + 1;
                    }
                }
            }
        }
        static int pretraga(int[]niz,int smer,int i,int br)
        {
            int j;
            bool flag = true;
            for(j=i;j<niz.Length && j>-1 && flag;j+=smer)
            {
                if ((niz[j + smer] >= br && smer == 1) || (niz[j + smer] <= br && smer == -1))
                    flag = false;
            }
            int c = i - j;
            if (c < 0)
                c *= -1;
            if (niz[i - 1] <= br && niz[i + 1] >= br)
                c = 0;
            return c;
        }
        static void Main(string[] args)
        {
            string[] nz = Console.ReadLine().Split();
            int n = int.Parse(nz[0]),m=int.Parse(nz[1]);
            int[] niz = new int[n];
            nz=Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
                niz[i] = int.Parse(nz[i]);
            Array.Sort(niz);
            nz=Console.ReadLine().Split();
            int[]res=new int[m];
            int p;
            for(int i=0;i<m; i++)
            {
                p = int.Parse(nz[i]);
                res[i] = resi(niz,p);
            }
            foreach(int i in res)
                Console.WriteLine(i);
            Console.ReadLine();
        }
    }
}