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

namespace NamestanjeGlasova
{
    internal class Program
    {
        static void unos(ref int n, ref int q, ref int[] a, ref int[] b,ref int[] a1)
        {
            string[] red= Console.ReadLine().Split(' ');
            n= int.Parse(red[0]);
            q = int.Parse(red[1]);
            red=Console.ReadLine().Split(' ');
            for(int i=0;i<n;i++)
            {
                a[i]=int.Parse(red[i]);
                a1[i]=int.Parse(red[i]);
            }
            red = Console.ReadLine().Split(' ');
            for(int i=0;i<q;i++)
            {
                b[i]=int.Parse(red[i]);
            }
        }
        static void promeni(ref int[] a,ref int[] b,int n)
        {
            a = new int[40001];
            for( int i = 0;i<n;i++)
            {
                a[i] = b[i];
            }
        }
        static void razmeni(ref int a,ref int b)
        {
            int p = a;
            a = b;
            b = p;
        }
        static int medijana(int[] a, int n)
        {
            return a[n / 2 ];
        }
        static void sort(ref int[] a,int l,int d)
        {
            if(l<d)
            {
                int k = l;
                for(int i=l+1;i<d;i++)
                {
                    if (a[i] <= a[l])
                    {
                        k++;
                        razmeni(ref a[i], ref a[k]);
                    }
                }
                razmeni(ref a[l], ref a[k]);
                sort(ref a, l, k);
                sort(ref a, k + 1, d);
            }
        }
        static int odrediMesto(int[] a, int n, int q)
        {
            for (int i = 0; i < n-1; i++)
            {
                if (q >= a[i] && q < a[i+1])
                {
                    return i+1;
                }
            }
            if (q < a[0])
            {
                return 0;
            }
            else
            {
                return n;
            }
        }
        static void insert(ref int[] a,ref int n,int q,int p)
        {
            for(int i=n+1;i>p;i--)
            {
                a[i] = a[i-1];
            }
            a[p] = q;
            //Console.WriteLine(a[p]);
            //Console.WriteLine(p);
            n++;
        }
        static void pisi(int[] a, int n)
        {
            for(int i=0;i<n;i++)
            {
                Console.Write(a[i] + " ");
            }
            Console.WriteLine();
        }
        static int brojGlasova(int[] a, int n, int q)
        {
            int p = 0;
            int x= odrediMesto(a,n,q);
            //Console.WriteLine(x);
            while (q != medijana(a, n))
            {
                //Console.WriteLine(medijana(a, n));
                insert(ref a, ref n, q, x);
                //pisi(a, n);
                p++;
            }
            return p;
        }
        static void Main(string[] args)
        {
            int[] a = new int[40001];
            int[] a1 = new int[40001];
            int[] b = new int[40001];
            int n=0, q=0;
            unos(ref n,ref q,ref a,ref b,ref a1);
            sort(ref a, 0, n);
            promeni(ref a1, ref a, n);
            //insert(ref a, ref n, b[2], 5);
            //pisi(a,n);
            for (int i = 0; i < q; i ++)
            {
                promeni( ref a, ref a1, n);
                Console.WriteLine(brojGlasova(a, n, b[i]));
            }
        }
    }
}