Problem:
Score : 800 points

Problem Statement

In Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 1 and N (inclusive) consisting of integers between 1 and K (inclusive) are listed.

Let the total number of sequences listed in FEIS be X. Among those sequences, find the (X/2)-th (rounded up to the nearest integer) lexicographically smallest one.

Constraints

1 \leq N,K \leq 3 × 10^5

N and K are integers.

Input

Input is given from Standard Input in the following format:

K N

Output

Print the (X/2)-th (rounded up to the nearest integer) lexicographically smallest sequence listed in FEIS, with spaces in between, where X is the total number of sequences listed in FEIS.

Sample Input 1

3 2

Sample Output 1

2 1

There are 12 sequences listed in FEIS: (1),(1,1),(1,2),(1,3),(2),(2,1),(2,2),(2,3),(3),(3,1),(3,2),(3,3).
The (12/2 = 6)-th lexicographically smallest one among them is (2,1).

Sample Input 2

2 4

Sample Output 2

1 2 2 2

Sample Input 3

5 14

Sample Output 3

3 3 3 3 3 3 3 3 3 3 3 3 2 2

Solution in C# (Mono 4.6.2.0) (judge verdict: Time Limit Exceeded)

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

namespace arc084_c
{
	class Program
	{
		static List<int[]> list = new List<int[]>();
		static void Calc(int[] arr, int limit, int remain)
		{
			if (!list.Contains(arr)) list.Add(arr);
			if (remain == 0) return;
			for (int i = 1; i <= limit; i++)
			{
				Calc(arr.Concat(new int[] { i }).ToArray(), limit,remain - 1);
			}
		}
		static void Main(string[] args)
		{
			/*for (int i = 1; i < 6; i++)
			{
				for (int j = 1; j < 6; j++)
				{
					list = new List<int[]>();
					Calc(new int[0], j, i);
					Console.WriteLine("Case" + i + " " + j);
					foreach (var item in list[list.Count / 2]) Console.Write(item + " ");
					Console.WriteLine();
				}
			}*/
			int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
			Calc(new int[0], x[0], x[1]);
			bool first = true;
			foreach (var a in list[list.Count / 2])
			{
				if (first) first = false;
				else Console.Write(" ");
				Console.Write(a);
			}
		}
	}
}