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

namespace ConsoleApp1
{
    internal class Program
    {
        public static int Pronadji(int[] a, int b)
        {
            bool t = false; 
            int start = a.Length % 2 == 0 ? a.Length / 2 + 1 : a.Length / 2;
            int ans = Pomeri(a, b, start, ref t, 0);
            return t ? ans - 1 : ans;
        }
        public static int Pomeri(int[] a, int b, int p, ref bool t, int k)
        {
            if (p < 0 || p > a.Length - 1)
            {
                t = true;
                return 0;
            }
            else if (a[p] == b)
            {
                return 0;
            }
            else if (a[p] < b)
            {
                if (k == 1)
                {
                    return 0;
                }
                k = -1;
                t = true;
                return 2 + Pomeri(a, b, p + 1, ref t, k);
            }
            else if (a[p] > b)
            {
                if (k == -1)
                {
                    return 0;
                }
                k = 1;
                t = true;
                return 2 + Pomeri(a, b, p - 1, ref t, k);
            }
            return 0;
        }
        public static void Main(String[] args)
        {
            string[] red = Console.ReadLine().Split();
            int n = Convert.ToInt32(red[0]);
            int q = Convert.ToInt32(red[1]);
            red = Console.ReadLine().Split();
            int[] a = new int[n];
            for(int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(red[i]);
            }
            Array.Sort(a);
            red = Console.ReadLine().Split();
            int[] b = new int[q];
            for (int i = 0; i < q; i++)
            {
                b[i] = Convert.ToInt32(red[i]);
            }
            for(int i = 0; i < q; i++)
            {
                Console.WriteLine(Pronadji(a, b[i]));
            }
            Console.ReadLine();
        }
    }
}