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

namespace PETLJA
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            List<int> x = new List<int>();
            for (int i = 0; i < n; i++)
            {
                x.Add(int.Parse(s[i]));
            }
            x.Sort();
            s = Console.ReadLine().Split();
            for (int i = 0; i < m; i++)
            {
                int c = 0;
                int q = int.Parse(s[i]);
                int b = n;
                if (x.IndexOf(q) == -1)
                {
                    x.Add(q);
                    x.Sort();
                    b++;
                    c = 1;
                }
                int l = x.IndexOf(q);
                int d = b - x.IndexOf(q) - 1;
                if (n % 2 == 0)
                {
                    if (d - l > 0)
                    {
                        Console.WriteLine(d - l + c);
                    }
                    else
                    {
                        Console.WriteLine(l - d - 1 + c);
                    }
                }
                else
                {
                    if (d - l >= 0)
                    {
                        Console.WriteLine(d - l + c);
                    }
                    else
                    {
                        Console.WriteLine(l - d - 1 + c);
                    }
                }
                if (c == 1)
                {
                    x.Remove(q);
                }
            }
        }
    }
}