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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n,q,i,j,br=0,z=0;
            string s1,s2,s3;
            int[] a;
            bool p=false;
            s1= Console.ReadLine();
            s2= Console.ReadLine();
            s3 = Console.ReadLine();
            string[]p1 = s1.Split(' ');
            n = int.Parse(p1[0]);
            q = int.Parse(p1[1]);
            string[]p2 = s2.Split(' ');
            a = new int[p2.Length]; 
            string[]p3 = s3.Split(' ');
            int[] b = new int[p3.Length];
            for(i=0;i<p2.Length;i++)
                a[i] = int.Parse(p2[i]);
            for (i = 0; i < p3.Length; i++)
                b[i] = int.Parse(p3[i]);
            for(i = 0; i <n; i++)
            {
                for(j=i; j<n; j++)
                {
                    if (a[i] > a[j])
                    {
                        z = a[i];
                        a[i] = a[j];
                        a[j] = z;
                    }
                }
            }
            for (i = 0; i <q; i++)
            {
                for(j=0;j<n;j++)
                {
                    if(b[i] == a[j])
                    {
                        z = j;
                        p = true;
                    }
                }
                if(p)
                {
                    if(z==n/2)
                        br = 0;
                    else
                    {
                        if(z<n/2)
                            br = Math.Abs(n / 2 - z);
                        else
                            br=z-n+z;
                    }
                }
                else
                {
                    j = 0;
                    while (a[j] < b[i])
                        j++;
                    if (j == n / 2+1)
                        br = 0;
                    else
                    {
                        if (j < n / 2+1)
                            br = Math.Abs(n / 2 - j)+1;
                        else
                            br = j - n + j+1;
                    }
                }
                Console.WriteLine("{0}", br);
            }
        }
    }
}