using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void pisi(int n, int[] a)
        {
            for (int i=0;i<n;i++)
            {
                Console.Write(a[i] + " ");
            }
            Console.WriteLine();
        }
        static void zameni (ref int a, ref int b)
        {
            int p = a;
            a = b;
            b = p;
        }
        static void sort (int n, int[] a)
        {
            for (int i=0;i<n-1;i++)
            {
                for (int j=i+1;j<n;j++)
                {
                    if (a[i] > a[j])
                    {
                        zameni(ref a[i], ref a[j]);
                    } 
                }
            }
        }
        static int medijana(int n, int[] a)
        {
            return a[n / 2];
        }
        
        static void Main(string[] args)
        {
            int N, Q;
            int[] A;
            int[] B;
            string[] nq = Console.ReadLine().Split();
            N=int.Parse(nq[0]);
            int Np = N;
            int[] pomocni = new int[1000000000];
            Q =int.Parse(nq[1]);
            string[] nizA = Console.ReadLine().Split();
            string[] nizB = Console.ReadLine().Split();
            A = new int [1000000000];
            B = new int [1000000000];
            for (int i=0;i<N;i++)
            {
                A[i] = int.Parse(nizA[i]);
            }
            for (int i=0;i<Np;i++)
            {
                pomocni[i] = A[i];
            }
            for (int i = 0; i < Q; i++)
            {
                B[i] = int.Parse(nizB[i]);
            }
            sort(N,  A);
            sort(Q,  B);
            for (int i=0;i<Q;i++)
            {
                int br = 0;
                while (medijana(N, A) != B[i])
                {
                    Array.Resize(ref A, N+1);
                    A[N] = B[i];
                    N++;
                    sort(N, A);
                    br++;
                }
                Console.WriteLine(br);
                A = new int[100000000];
                N = Np;
                for (int j=0;j<Np;j++)
                {
                    A[j] = pomocni[j];
                }
            }
        }
    }
}