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

namespace ConsoleApp2
{
    internal class Program
    {
            static void Main(string[] args)
            {
                string[] s = Console.ReadLine().Split();
                string[] a1 = Console.ReadLine().Split();
                string[] b1 = Console.ReadLine().Split();
                int n = int.Parse(s[0]);
                int q = int.Parse(s[1]);
                int[] a = new int[n];
                int[] b = new int[q];
                for (int i = 0; i < n; i++)
                {
                    a[i] = int.Parse(a1[i]);
                }
                for (int i = 0; i < q; i++)
                {
                    b[i] = int.Parse(b1[i]);
                }
                Array.Sort(a);
                int meda = a[n / 2];
                int t = 0;
                int br = 0;
                for (int i = 0; i < q; i++)
                {
                    t = b[i];
                    for (int j = 0; j < n; j++)
                    {
                        if (t <= a[n - 1] && t >= a[0])
                        {
                            if (meda == t)
                            {
                                br = 0;
                                break;
                            }
                            else if (t > a[j] && t < a[j + 1])
                            {
                                if (j <= n / 2)
                                {
                                    br = j + 1;
                                    break;
                                }
                                else
                                {
                                    br = (j + 1) / 2;
                                }
                            }
                            else if (t == a[j])
                            {
                                if (j <= n / 2)
                                {
                                    br = j - 1;
                                    break;
                                }
                                else
                                {
                                    br = (j - 1) / 2;
                                    break;
                                }
                            }

                        }
                        else if (t > a[n - 1] || t < a[0])
                        {
                            br = n;
                            break;
                        }
                    }
                    Console.WriteLine(br);
                }
            }
        }
    }