using System;
using System.Collections.Generic;

namespace takm // Note: actual namespace depends on the project name.
{
    internal class Program
    {
        static int Medijana(int n)
        {
            /*if (n % 2 != 0) return n / 2;
            else return n / 2 + 1;*/
            return n / 2;
        }
        static int Postoji (int[]a, int b)
        {
            for (int i=0;i<a.Length;i++)
            {
                if (a[i] == b) return i;
            }
            return -1;
        }
        static int Indeks (int[]a, int i, int medijana)
        {
            int i2 = i;
            for (int j = i; a[j] == a[i]; j++) i2++;
            if (Math.Abs(medijana - i2) > Math.Abs(medijana - i)) return i;
            else return i2;
        }
        static int Ukrasti(int[]a, int b, int medijana_i)
        {
            int resenje = 0;
            int n = a.Length;
            if (a[medijana_i] == b) return 0;
            else
            {
                if (Postoji(a, b)!=-1) //proveriti samo za koliko treba pomeriti
                {
                    int l = Indeks(a, Postoji(a, b), medijana_i);
                    int p = l;
                    int k = a.Length - 1 - l;
                    if (l > medijana_i)
                    {
                        while (Medijana(n) != l)
                        {

                            resenje++;
                            n++;
                        }
                    }
                    else
                    {
                        while (Medijana(n) != l)
                        {
                            l++;
                            resenje++;
                            n++;
                        }
                    }
                    return resenje;
                }
                else return a.Length; //zavisi gde se ubacuje
            }
        }
        static void Main(string[] args)
        {
            string[] red = Console.ReadLine().Split();
            int n=Convert.ToInt32(red[0]);
            int q=Convert.ToInt32(red[1]);
            int[] a = new int[n];
            int[] b = new int[q];
            red = Console.ReadLine().Split();
            for (int i = 0; i < n; i++) a[i]=Convert.ToInt32(red[i]);
            Array.Sort(a);
            int medijana_i = Medijana(n);
            red = Console.ReadLine().Split();
            for (int i = 0; i < q; i++) b[i] = Convert.ToInt32(red[i]);

            for (int j = 0; j < q; j++) Console.WriteLine(Ukrasti(a, b[j], medijana_i));
        }
    }
}