using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    internal class Program
    {
        
        static bool Sortiran(int[]a,int n)
        {
            for(int i = 0; i < n-1; i++)
            {
                if (a[i] > a[i + 1])
                    return false;
            }
            return true;
        }
        static void Sort(int[] a, int n)
        {
            int k;
            while (Sortiran(a, n) != true)
                for (int i = 0; i < n - 1; i++)
                {
                    if (a[i] > a[i + 1])
                    {
                        k = a[i];
                        a[i] = a[i + 1];
                        a[i + 1] = k;
                    }
                }
        }
        private static void Main(string[] args)
        {
            int br=0,i;
            string s = Console.ReadLine();
            string[] s1 = s.Split(" ");
            int n = int.Parse(s1[0]);
            int m = int.Parse(s1[1]);
            int[] a = new int[n * 2 + 2];
            int[] b = new int[m];
            s = Console.ReadLine();
            s1 = s.Split(" ");
            for(i = 0; i < n; i++)
                a[i] = int.Parse(s1[i]);
            s = Console.ReadLine();
            string[] s2 = s.Split(" ");
            for (i = 0; i < m; i++)
                b[i] = int.Parse(s2[i]);
            Sort(a, n);
            int[]a1 = new int[n];
            int n1 = n;
            for (i = 0; i < n; i++)
                a1[i] = a[i];
            for (int j = 0;j<m;j++)
            {
                while (b[j] != a[n / 2])
                {
                    a[n] = b[j];
                    Sort(a, n);
                    n++;
                    br++;

                }
                n = n1;
                for (i = 0; i < n; i++)
                    a[i] = a1[i];
                Console.WriteLine(br);
                br = 0;
            }


        }
    }
}