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

namespace ConsoleApplication33
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] r = Console.ReadLine().Split(' ');
            int n = int.Parse(r[0]);
            int q = int.Parse(r[1]);


            string[] A = Console.ReadLine().Split(' ');
            int[] a = new int[n+1];
            for (int i = 1; i < n; i++)
            {
                a[i] = int.Parse(A[i]);
            }


            string[] B = Console.ReadLine().Split(' ');
            int[] b = new int[q];
            for (int i = 0; i < q; i++)
            {
                b[i] = int.Parse(B[i]);
            }

            Array.Sort(a);
            int medijana=a[(n/2)+1];
            

            int k=0;bool t=true;
            for (int j = 0; j < q; j++)
            {
                for (k = 0; t==true && k < n; k++)
                {
                    if (b[j] == a[k])
                    {
                        int d = n - k;
                        int l = k - 1;
                        int broj = Math.Abs(d - l);
                        if ((n + broj) % 2 == 1 && l>d) broj--;
                        t = false;
                        Console.WriteLine(broj);
                        
                    }
                }
                if (t)
                {

                    a[0] = b[j];
                    Array.Sort(a);
                    for (k = 0; k < n+1 && a[k] != b[j]; k++) ;
                        
                    int d = n + 1 - k;
                    int l = k;
                    int broj = Math.Abs(d - l);
                    if ((n + 1 + broj) % 2 == 1 && l>d) broj--;
                    Console.WriteLine(broj);

                }
                t = true;
            }
            
            //Console.ReadLine();
 
        }
    }
}