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++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;
int read()
{
	char s;
	int k=0,base=1;
	while((s=getchar())!='-'&&s!=EOF&&!(s>='0'&&s<='9'));
	if(s==EOF)exit(0);
	if(s=='-')base=-1,s=getchar();
	while(s>='0'&&s<='9')
	{
		k=k*10+(s-'0');
		s=getchar();
	}
	return k*base;
}
void write(int x)
{
	if(x<0)
	{
		putchar('-');
		write(-x);
	}
	else
	{
		if(x/10)write(x/10);
		putchar(x%10+'0');
	}
}
const int maxn=3e5+100;
int n,k,x,p[maxn],y,a;
int main()
{
	freopen("1,out","w",stdout);
	k=read();n=read();
	if (k%2==0)
	{
		printf("%d ",k/2);
		for (int i=2;i<=n;i++) printf("%d ",k);
		return 0;
	}
	if (k==1)
	{
		for (int i=1;i<=(n+1)/2;i++) printf("1 ");
		return 0;
	}
	x=n/2;y=(k+1)/2;
	for (int i=1;i<=n;i++) p[i]=y;
	while (x--)
	{
		a=n;
		while (p[a]==0) a--;
		if (p[a]==1)
		{
			p[a]=0;
	//		if (a<=6)
	//		{for (int i=1;i<=n;i++) if (p[i]==0) break; else printf("%d ",p[i]);
	//		printf("\n");}
			continue;
		}
		a=n;
		p[a]--;
		while (p[a]==-1||(p[a]==0&&p[a+1]!=0))
		{
			p[a]=k;a--;p[a]--;
		}
//		for (int i=1;i<=n;i++)
//		{
//			if (p[i]==0) break;
//			printf("%d ",p[i]);
//		}putchar('\n');
	}

	for (int i=1;i<=n;i++) if (p[i]==0) break; else printf("%d ",p[i]);
	return 0;
	//http://arc084.contest.atcoder.jp/tasks/arc084_c
}