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

namespace vezbanje_2._1
{
    internal class Program
    {
        static void Main(string[] args)
        {
           // int x = 7 / 2; uzme 3 ili 5/2 uzme 2
            
            string[] brojevi = Console.ReadLine().Split(' ');
            int N = Convert.ToInt32(brojevi[0]);
            int Q = Convert.ToInt32(brojevi[1]);
            int[] a; int i;
            int[] b; int k;


            string[] glasovi = Console.ReadLine().Split(' ');
            a = new int[N];
            for (i = 0; i<N; i++) 
            {
                a[i] = int.Parse(glasovi[i]);
            }
            int ii, j, pom;
            int n = a.Length;
            ii = 0;
            for (ii = 0; ii < n; ii++)//nebitan deo za sad
            {
                for (j = ii + 1; j < n; j++)
                {
                    if (a[j] < a[ii])
                    {
                        pom = a[ii];
                        a[ii] = a[j];
                        a[j] = pom;
                    }
                }
                
            }//nebitan deo za sad

            


            string[] slucajevi = Console.ReadLine().Split(' ');
            b = new int[Q];
            for (k = 0; k < Q; k++)
            {
                b[k] = int.Parse(slucajevi[k]);

            }
            for(k=0; k < Q; k++)
            {
                for(i = 0; i < N; i++)
                {
                    if(a[i] == b[k])
                    {
                        int pp = i;
                        if (n % 2 != 0)
                        {
                            if (a[ (n + 1) / 2] == b[k])
                            {
                                Console.WriteLine(0);
                            }
                            else if (a[(n + 1) / 2] < b[k])
                            {
                                int nn = n;
                                while(a[(nn + 1) / 2] < b[k])
                                {
                                    nn++;
                                    
                                }
                                if (((nn - n) % 2) != 0)
                                {
                                    Console.WriteLine(((n-(n-nn)) - 1) / 2);//
                                }
                                else if (((nn - n) % 2) == 0)
                                {
                                    Console.WriteLine(((n-(n-nn)) + 1) / 2);//
                                }
                                
                            }
                            else if(a[(n + 1) / 2] > b[k])/////////////////////////
                            {
                                int nn = n;
                                while (a[(nn + 1) / 2] < b[k])
                                {
                                    nn++;

                                }
                                if (((nn - n) % 2) != 0)
                                {
                                    Console.WriteLine(((n-(n - nn)) - 1) / 2);//
                                }
                                else if (((nn - n) % 2) == 0)
                                {
                                    Console.WriteLine(((n -(n- nn ))+ 1) / 2);//
                                }
                            }
                        }
                        else if (n % 2 == 0)////////////////////////////////////////////////////////////
                        {
                            int nn = n;
                            while (a[(nn + 1) / 2] < b[k])
                            {
                                nn++;

                            }
                            if (((nn - n) % 2) != 0)
                            {
                                Console.WriteLine(((n - (n - nn)) - 1) / 2);//
                            }
                            else if (((nn - n) % 2) == 0)
                            {
                                Console.WriteLine(((n - (n - nn)) + 1) / 2);//
                            }
                        }
                    }
                    else
                    {
                        
                    }
                }
            }



            
           


            
        }
    }
}