using System;
using System.Collections.Generic;
using System.Globalization;

namespace Takmicenje_petlja_2
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            string nqs = Console.ReadLine();
            string votess = Console.ReadLine();
            string medianass = Console.ReadLine();

            int numberOfVotes = 0;
            int left, right;

            string[] nq = nqs.Split();
            int n = int.Parse(nq[0]);
            int q = int.Parse(nq[1]);
            
            int[] votes = new int[n];
            string[] votesSp = votess.Split();
            for (int i = 0; i < n; i++)
            {
                votes[i] = int.Parse(votesSp[i]);
            }

            int[] medianas = new int[q];
            string[] medianasSp = medianass.Split();
            for (int i = 0; i < q; i++)
            {
                medianas[i] = int.Parse(medianasSp[i]); 
            }

            foreach (var mediana in medianas)
            {
                left = BinarySearch(votes, mediana); 
                right = n - left -1;
                if (!BinarySearchExist(votes, mediana))
                {
                    left++;
                    numberOfVotes = (int)Math.Abs(left - right) + 1;
                }
                else numberOfVotes = (int)Math.Abs(left - right);
                if (numberOfVotes != 0) Console.WriteLine(numberOfVotes - 1);
                else Console.WriteLine(numberOfVotes);
            }
            
        }
        
        static int BinarySearch(int[] array, int wantednumber)
        {
            int prelomnatacka;
            int currentArrayEnd = array.Length -1 ;
            int currentArrayBeggining = 0;
            while (currentArrayBeggining <= currentArrayEnd)
            {
                prelomnatacka = (currentArrayBeggining + currentArrayEnd ) / 2; 
                if (array[prelomnatacka] > wantednumber)
                {
                    currentArrayEnd = prelomnatacka - 1;
                }
                else if (array[prelomnatacka] < wantednumber)
                {
                    currentArrayBeggining = prelomnatacka + 1;
                }
                else
                {
                    return prelomnatacka;
                }
            }

            return currentArrayBeggining-1;
        }
        
        static bool BinarySearchExist(int[] array, int wantednumber)
        {
    
            int prelomnatacka;
            int currentArrayEnd = array.Length -1 ;
            int currentArrayBeggining = 0;
            while (currentArrayBeggining <= currentArrayEnd)
            {
                prelomnatacka = (currentArrayBeggining + currentArrayEnd ) / 2; 
                if (array[prelomnatacka] > wantednumber)
                {
                    currentArrayEnd = prelomnatacka - 1;
                }
                else if (array[prelomnatacka] < wantednumber)
                {
                    currentArrayBeggining = prelomnatacka + 1;
                }
                else
                {
                    return true;
                }
            }

            return false;
        }

    }
}