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

namespace ConsoleApplication320
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int k = int.Parse(s[1]);
            int[] a = new int[n];
            int[] b = new int[k];
            string[] s1 = Console.ReadLine().Split();
            string[] s2 = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s1[i]);
            }
            for (int i = 0; i < k; i++)
            {
                b[i] = int.Parse(s2[i]);
            }
            
            for (int i = 0; i < k; i++)
            {
                int z = 0;
                if (b[i] > a[n - 1])
                    {
                        z = n;
                        Console.WriteLine(z);
                    }
                    else if (b[i] < a[0])
                    {
                        z = n + 1;
                        Console.WriteLine(z);
                    }
                for (int j = 0; j < n; j++)
                {
                    
                    if (b[i] == a[j])
                    {
                        if (a[j] == a[n / 2])
                        {
                            z = 0;
                            Console.WriteLine(z);
                        }
                        else if (a[j] > a[n / 2])
                        {
                            z = (j - (n / 2)) * 2 - 1;
                            Console.WriteLine(z);
                        }
                        else if (a[j] < a[n / 2])
                        {
                            z = (n / 2 - j) * 2;
                            Console.WriteLine(z);
                        }
                    }
                }
            }
            Console.Read();
        }
    }
}