using System;
using System.Collections.Generic;
namespace takmicenjeKvalifikacije
{
    internal class Program
    {
        static int binarySearch(int[] arr, int l, int r, int x)
        {
            if (r >= l)
            {
                int mid = l + ((r - l) / 2);

                if (arr[mid] == x)
                    return mid;
                else if (arr[mid] > x)
                    return binarySearch(arr, l, mid - 1, x);

                return binarySearch(arr, mid + 1, r, x);
            }
            return -1;
        }
        static void Main(string[] args)
        {
            string[] sr = Console.ReadLine().Split();
            int n = int.Parse(sr[0]), q = int.Parse(sr[1]);
            int[] a = new int[n];
            sr = Console.ReadLine().Split();
            for(int i = 0; i < n; i++)
            {
                a[i] = int.Parse(sr[i]);
            }
            Array.Sort(a);

            sr = Console.ReadLine().Split();
            int br = 0;

            for (int i = 0; i < q; i++)
            {
                int pom = binarySearch(a, 0, n - 1, int.Parse(sr[i]));
                int sredina = (n + br) / 2 + 1;
                if (pom != -1)
                {
                    if (pom + 1 != sredina)
                    {
                        br += (pom + 1) / 2 - 1;
                    }
                }
                else br += n - 1;
                Console.WriteLine(br);
            }
        }
    }
}