using System;
using System.Collections.Generic;
internal class Program
{
    public static int Medijana(List<int> a)
    {
        a.Sort();
        return a.Count / 2;
    }
    static void Main(string[] args)
    {
        int n, q;
        string[] str = Console.ReadLine().Split(" ");
        n = int.Parse(str[0]);
        q = int.Parse(str[1]);

        List<int> A = new List<int>();
        List<int> A1 = new List<int>();
        List<int> B = new List<int>();

        
        
        str = Console.ReadLine().Split(" ");

        for(int i = 0; i < n; i++)
        {
            A.Add(int.Parse(str[i]));
            A1.Add(int.Parse(str[i]));
        }

        str = Console.ReadLine().Split(" ");

        for (int i = 0; i < q; i++)
        {
            B.Add(int.Parse(str[i]));
        }

        List<int> res = new List<int>();

        A.Sort();
        A1.Sort();

        int medijana = A[Medijana(A)];


        for (int i = 0; i < q; i++)
        {
            if (B[i] == medijana)
                res.Add(0);

            if (B[i] > A[A.Count - 1])
                res.Add(B[i] - A[Medijana(A)]);

            if(B[i] > medijana)
            {
                int k = B[i] + 1;
                int j = 0;
                while (B[i] != A1[Medijana(A1)])
                {
                    A1.Add(k);
                    A1.Sort();
                    j++;
                }
                res.Add(j);
                A1 = A;
            }

            if(B[i] < medijana)
            {
                int k = B[i] - 1;
                int j = 0;
                while (B[i] != A1[Medijana(A1)])
                {
                    A1.Add(k);
                    A1.Sort();
                    j++;
                }
                res.Add(j);
                A1 = A;
            }
        }

        foreach (int x in res)
            Console.WriteLine(x);
    }
}