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

namespace ConsoleApp1
{
	internal class Program
	{
		static void Main(string[] args)
		{
			int[] p=new int[2];
			int i,k;
			string[] str = Console.ReadLine().Split();
			for (i=0;i<2;i++)
			{
				p[i]= int.Parse(str[i]);
			}
			int n = p[0],q = p[1];
			int[] a=new int[n];
			int[] b=new int[q];
			str = Console.ReadLine().Split();
			for (i = 0; i < n; i++)
			{
				a[i] = int.Parse(str[i]);
			}
			str = Console.ReadLine().Split();
			for (i = 0; i < q; i++)
			{
				b[i] = int.Parse(str[i]);
			}
			for (i = 0; i< n-1;i++)
			{
				if (a[i] > a[i+1])
				{
					k = a[i + 1];
					a[i + 1] = a[i];
					a[i] = k;
					i = -1;
				}
			}
			int o = 0, j = 0; i=0;
			for (i=0;i<q;i++)
			{
				int d = 0;
				o = 0;
				if (b[i] < a[n-1])
				{
					for (j=0;j<n;j++)
					{
						if (b[i] == a[j])
						{
							o++;
							j = n;
						}
					}
					if (o>0)
					{
						for (j=n/2;j<n;j++)
						{
							if (a[j] != b[i])
							{
								d++;
							}
							else if ((n+d)%2==5 && d!=0)
							{
								d++;
								Console.WriteLine(d);
							}
							else
							{
								Console.WriteLine(d);
							}
						}
					}
					else
					{
						a = new int[n + 1];
						for (j=0;j<n;j++)
						{
							if (b[i] < a[j])
							{
								int r = j;
								for (j=n-1;j>=r;j--)
								{
									a[j + 1] = a[j];
								}
								a[r] = b[i];
								j = n;
							}
						}						
						for (j = (n+1) / 2; j < n; j++)
						{
							if (a[j] != b[i])
							{
								d++;
							}
							else if ((n + d) % 2 == 5 && d != 0)
							{
								d++;
								Console.WriteLine(d);
							}
							else
							{
								Console.WriteLine(d);
							}
						}
					}
				}
				else
				{
					d = n;
					Console.WriteLine(d);
				}
			}
		}
	}
}