using System.Linq;
using System;
using System.Collections.Generic;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        int br=0,MedijanaNizaA;
        int N = int.Parse(Console.ReadLine());
        int Q = int.Parse(Console.ReadLine());
        List<int> A = new List<int>();
        List<int> A1 = new List<int>();
        List<int> B = new List<int>();
        Random rndA = new Random();
        Random rndB = new Random();
        A1.Add(1);
        if(N>=1 && N<=2*100000)
        {
        for(int i=1;i<N;i++)
        {
            int a = rndA.Next(1, 1000000000);
            A.Add(a);
            A1.Add(a);
            Console.Write("{0} ",a);
        }
        int n = rndA.Next(1, 1000000000);
        A.Add(n);
        A1.Add(n);
        Console.WriteLine(n);
        for(int l=1;l<=Q;l++)
            { 
                int b = rndB.Next(1, 1000000000);
                B.Add(b);
                Console.WriteLine("{0}",b);
            } 
        A1.Sort();
        MedijanaNizaA=A1[(N/2+1)];
        
        while(MedijanaNizaA!=B[0])
        {
            N++;
            A1.Add(B[0]);
            A1.Sort();
            MedijanaNizaA=A1[(N/2+1)];
            br++;
        }
        Console.WriteLine(br);
        }
    }
}