using System;
public class HelloWorld
{
    public static void Main(string[] args)
        {
        string[] str;
        bool t = false;
        int z = 0;
        int zz = 0;
        str = Console.ReadLine().Split();
        int n = int.Parse(str[0]);
        int q = int.Parse(str[1]);
        int[] a = new int[n];
        int[] b = new int[q];
        int d;
        str = Console.ReadLine().Split();
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(str[i]);
            }
            str = Console.ReadLine().Split();
            for (int i = 0; i < q; i++)
            {
                b[i] = int.Parse(str[i]);
                }
                Array.Sort(a);
                for(int i = 0; i < q; i++)
                {
                    for(int j = 0; j < n; j++)
                        {
                                if(b[i] == a[j])
                                        {
                                                    t = true;
                                                                d = j;
                                                                            break;
                                                                                    }
                                                                                        }
                                                                                            if(t)
                                                                                                {
                                                                                                        if ((a[(n - 1) / 2] == b[i] && n % 2 != 0) || (a[n / 2] == b[i] && n % 2 == 0))
                                                                                                                    Console.WriteLine(0);
                                                                                                                            else if (a[(n - 1) / 2] != b[i] && n % 2 != 0)
                                                                                                                                    {
                                                                                                                                                for (int j = 0; j < n; j++)
                                                                                                                                                                if (a[j] == b[i])
                                                                                                                                                                                {
                                                                                                                                                                                                    z = j;
                                                                                                                                                                                                                        zz = n - j - 1;
                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                    if(z - 1 >= n / 2)
                                                                                                                                                                                                                                                                    Console.WriteLine(Math.Abs(z - zz) - 1);
                                                                                                                                                                                                                                                                                else
                                                                                                                                                                                                                                                                                                Console.WriteLine(Math.Abs(z - zz));
                                                                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                                                                                else if (a[n / 2] != b[i] && n % 2 == 0)
                                                                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                                                                                    for (int j = 0; j < n; j++)
                                                                                                                                                                                                                                                                                                                                                    if (a[j] == b[i])
                                                                                                                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                                                                                                                                        z = j;
                                                                                                                                                                                                                                                                                                                                                                                                            zz = n - j - 1;
                                                                                                                                                                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                                                                                                                                                                                        Console.WriteLine(Math.Abs(z - zz));
                                                                                                                                                                                                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                        t = false;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                else
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            if (b[i] >= a[n - 1])
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Console.WriteLine(n);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                else if (b[i] <= a[0])
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Console.WriteLine(n + 1);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    else
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        z = 0;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    for(int j = 0; j < n; j++)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                if (a[j] > b[i])
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    break;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    z++;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            zz = n - z;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        if (z >= zz)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Console.WriteLine(z - zz);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    else
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Console.WriteLine(zz - z + 1);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                }        
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Petlja.org
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Fondacija Petlja
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       loop@petlja.org
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       © Copyright 2022. Petlja.org
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Graficki dizajn enjoy.ing