atcoder#ARC084C. [ARC084E] Finite Encyclopedia of Integer Sequences

[ARC084E] Finite Encyclopedia of Integer Sequences

Score : 800800 points

Problem Statement

In Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 11 and NN (inclusive) consisting of integers between 11 and KK (inclusive) are listed.

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

Constraints

  • 1N,K3×1051 \leq N,K \leq 3 \times 10^5
  • NN and KK are integers.

Input

Input is given from Standard Input in the following format:

KK NN

Output

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

3 2
2 1

There are 1212 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)(12/2 = 6)-th lexicographically smallest one among them is (2,1)(2,1).

2 4
1 2 2 2
5 14
3 3 3 3 3 3 3 3 3 3 3 3 2 2