using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;

class namestanjeGlasanja
{

    static void Main()
    {
        var linija = Console.ReadLine().Split(' ');
        int N = int.Parse(linija[0]);
        int Q = int.Parse(linija[1]);
        int i = 0;
        int[] A = new int[N];
        int[] B = new int[Q];
        int[] x = new int[2 * N];
        var linija1 = Console.ReadLine().Split(' ');
        for (i = 0; i < N; i++)
        {
            A[i] = int.Parse(linija1[i]);
            x[i] = A[i];
        }

        int j = 0;

        var linija2 = Console.ReadLine().Split(' ');
        for (i = 0; i < Q; i++)
        {
            B[i] = int.Parse(linija2[i]);
        }
        i = N - 1;
        int k = N;
        Array.Sort(A);
        int z = A[N / 2];
        int M = z;
        int br = 0;
        for (j = 0; j < Q; j++)
        {
            k = N;
            br = 0;
            Array.Clear(x, 0, 2 * N);
            Array.Copy(A, x, N);
            M = z;
            i = N - 1;
            if (B[j] != A[i] && B[j] > A[N - 1])
            {
                while (M != B[j])
                {
                    x[k++] = B[j];
                    M = x[k / 2];
                    br++;
                    if (M == B[j]) break;

                }
            }
            else
            {
                for (i = N - 1; i >= 0; i--)
                {
                    if (x[i] == B[j])
                    {
                        M = x[k / 2];
                        while (M != B[j])
                        {
                            x[k++] = B[j];
                            if (x[i] < M)
                                Array.Sort(x, 0, k);
                            M = x[k / 2];
                            br++;
                            if (M == B[j]) break;
                        }
                        if (M == B[j]) break;
                    }
                    else if (i != 0 && B[j] > x[i - 1])
                    {
                        x[k++] = B[j];
                        Array.Sort(x, 0, k);
                        i++;
                        br++;
                    }
                }

            }
            Console.WriteLine(br);
        }
    }
}