using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Zadatak2
{
    internal class Program
    {
        static void Razmeni(ref int a, ref int b)
        {
            int temp = a;
            a = b;
            b = temp;
        }
        static void Sortiraj(int[] a, int n)
        {
            for (int i = 0; i < n - 1; i++)
                for (int j = i + 1; j < n; j++)
                    if (a[i] > a[j])
                        Razmeni(ref a[i], ref a[j]);
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]), q = int.Parse(s[1]);

            s = Console.ReadLine().Split();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(s[i]);

            s = Console.ReadLine().Split();
            int[] b = new int[n];
            for (int i = 0; i < q; i++)
                b[i] = int.Parse(s[i]);

            Sortiraj(a, n);

            int m = a[a.Length / 2];
            for (int j = 0; j < q; j++)
            {
                int x = -1, manji = 0, manjiIndex = 0, veci = 1000000, veciIndex = 0;
                if (b[j] == m)
                {
                    Console.WriteLine(0);
                    x = -2;
                }
                else if (b[j] > m)
                {
                    for (int i = n / 2; i < n; i++)
                    {
                        if (a[i] == b[j])
                        {
                            x = i;
                            break;
                        }

                        if (b[j] > a[i] && a[i] > manji)
                        {
                            manji = a[i];
                            manjiIndex = i;
                        }
                    }

                    int l = x, d = n - 1 - x;

                    if (x != -1) 
                        Console.WriteLine(l - d - 1);
                }
                else
                {
                    for (int i = 0; i <= n / 2; i++)
                    {
                        if (a[i] == b[j])
                        {
                            x = i;
                            break;
                        }

                        if (b[j] < a[i] && a[i] < veci)
                        {
                            veci = a[i];
                            veciIndex = i;
                        }
                    }

                    int l = x, d = n - 1 - x;

                    if (x != -1)
                        Console.WriteLine(d - l);
                }

                if (x == -1)
                {
                    if (b[j] > m)
                    {
                        x = manjiIndex;
                        int l = x, d = n - 1 - x;
                        Console.WriteLine(l - d + 1);
                    }
                    if (b[j] < m)
                    {
                        x = veciIndex;
                        int l = x, d = n - x;
                        Console.WriteLine(d - l + 1);
                    }
                }
            }

        }
    }
}