Subsequence Sums

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Yuta has a sequence of nn positive integers A_1,,A_nA\_1, \ldots, A\_n, and their sum is mm. For each subsequence SS of AA, he calculated the sum of elements in this subsequence.

So, now Yuta has also got 2n2^n integers between 00 and mm. For each i\[0,m]i \in \[0, m], let B_iB\_i be the number of integers ii he got.

Yuta shows you the array B_iB\_i, and he asks you to restore A_1,,A_nA\_1, \ldots, A\_n. If there are several possibilities, find the lexicographically smallest possible sequence.

입력

The first line of the input contains two integers nn and mm (1n501 \leq n \leq 50, 1m1041 \leq m \leq 10^4).

The second line contains m+1m + 1 integers B_0,,B_mB\_0, \ldots, B\_m (0B_i2n0 \leq B\_i \leq 2^n).

출력

Print a single line with nn integers A_1,,A_nA\_1, \ldots, A\_n.

It is guaranteed that there exists at least one solution. And if there are several possible solutions, print the lexicographically smallest one.

힌트

In the first example, AA is \[1,2]\[1, 2]. AA has four subsequences \[]\[], \[1]\[1], \[2]\[2] and \[1,2]\[1,2], and the sums for them are 00, 11, 22 and 33. So, B=\[1,1,1,1]B = \[1, 1, 1, 1].