using System;
using System.Collections.Generic;

namespace zad2_takm
{
    class Program
    {
        static  int ubacivanje(List<long>a,long value)
        {
            int low = 0;
              int  high =a.Count;

            while (low < high)
            {
                int mid = (low + high) >> 1;
                if (a[mid] < value) low = mid + 1;
                else high = mid;
            }
            return low;
        }
        static int br(List<long>a,long med)
        {
            int res = 0;
            bool pom = false;
            if (!a.Contains(med))
            {
                a.Insert(ubacivanje(a, med), med);
                res++;
                pom = true;
            }
            int n = a.Count;
            if (a[n / 2] == med) return 0;
            else if (med < a[n / 2])
            {
                if (a.Count % 2 == 0) res=res+ (n / 2 - a.LastIndexOf(med))*2-1;
                else res=res+ (n / 2  - a.LastIndexOf(med))*2;
                    }
            else
            {
                if (a.Count % 2 == 0) res=res+ (a.IndexOf(med)-n/2)*2;
                else res=res+ (a.LastIndexOf(med)-n/2)*2-1;
            }
           if(pom)a.Remove(med);
            return res;
        }
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            long  n = int.Parse(unos[0]);
            long q = int.Parse(unos[1]);
            unos = Console.ReadLine().Split();
            List<long> a = new List<long>();
            for(int i = 0; i < n; i++)
            {
                a.Add(long.Parse(unos[i]));
            }
            a.Sort();
            unos = Console.ReadLine().Split();
            for (int i = 0; i < q; i++) {
                long med = long.Parse(unos[i]);
                Console.WriteLine(br(a, med));
            }
        }
    }
}