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

namespace ConsoleApp2
{
    class Program
    {
        static void sort(int[] a, int n)
        {
            int p;
            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    if (a[i] > a[j])
                    {
                        p = a[i];
                        a[i] = a[j];
                        a[j] = p;
                    }

                }
            }
        }
        static void Citaj(out int[] a, out int[] b, out int n, out int q)
        {
            int[] c = new int[2];
            string[] s1 = Console.ReadLine().Split(' ');
            for (int i = 0; i < 2; i++)
            {
                c[i] = int.Parse(s1[i]);
            }
            n = c[0];
            q = c[1];

            a = new int[n];
            string[] s2 = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s2[i]);
            }
            b = new int[q];
            string[] s3 = Console.ReadLine().Split(' ');
            for (int i = 0; i < q; i++)
            {
                b[i] = int.Parse(s3[i]);
            }
        }
        static void Stampaj(int[] a, int n)
        {
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(a[i]);
            }
        }
        static void Main(string[] args)
        {

            int[] a,b,izlaz;
            int n, q, br = 0, zb1 = 0, zb2 = 0;
            Citaj(out a,out b, out n, out q);
            sort(a, n);
            izlaz = new int[q];
            for(int i = 0; i < q; i ++)
            {
                if (b[i] > a[n - 1] || b[i] < a[0])
                {
                    izlaz[i] = n;
                }
                else
                {
                    for (int j = 0; j < n; j++)
                    {
                        if (b[i] == a[j])
                        {
                            br = j;
                            break;
                        }
                        else if (b[i] > a[j])
                        {
                            br = j;
                        }

                    }
                    for(int t = br + 1; t < n; t++)
                    {
                        zb1++;
                    }
                    for (int t = br; t > 0; t--)
                    {
                        zb2++;
                    }
                    if(n % 2 != 0)
                    {
                        if (b[i] <= a[n / 2])
                        {
                            if (zb1 > zb2)
                                izlaz[i] = zb1 - zb2;
                            else izlaz[i] = zb2 - zb1;
                        }
                        else
                        {
                            if(zb1 > zb2)
                                izlaz[i] = zb1 - zb2 -1;
                            else izlaz[i] = zb2 - zb1 - 1;
                        } 
                    }
                    else
                    {
                        if (b[i] <= a[n / 2 - 1])
                        {
                            izlaz[i] = Math.Abs(zb1 - zb2);
                        }
                        else izlaz[i] = Math.Abs(zb1 - zb2) - 1;
                    } 
                }
                zb1 = 0;
                zb2 = 0;
            }
            Stampaj(izlaz, q);
        }
    }
}