Lost&Found

Time limit: 1s Memory limit: 64MB Input: Output:

Task

Initially, there was a sequence of NN natural numbers between 11 and VV, where VV is of the form 2k−1,k∈N2^{k}-1, k \in \mathbb{N}. This sequence was lost, and all that remains is a sequence ZZ of size VV defined as follows: Zi=∣{j ∣ i&Aj≠0, 1≤j≤N}∣Z_i = |\{j ~|~ i \& A_j \neq 0,~1 \leq j \leq N \}|, where &\& represents the bitwise AND operation. More precisely, ZiZ_i is the number of elements jj for which Aj&i≠0A_j \& i \neq 0. You are given the sequence ZZ and are asked to find a possible initial sequence.

Input data

On the first line, the numbers NN and VV are given. On the second line, the sequence ZZ (indexed from 11) is given.

Output data

A sequence of NN numbers between 11 and VV with the significance described in the statement, or −1-1 if no such sequence exists.

Constraints and clarifications

  • 1≤N,V≤2⋅1051 \leq N, V \leq 2 \cdot 10^{5};
  • ZZ is indexed from 11.
  • 1≤Z[i]≤1091 \leq Z[i] \leq 10^{9}
  • Any correct solution is accepted.
  • For 3030 points, V=3V = 3.

Example 1

stdin

2 3
2 0 2

stdout

1 1

Explanation

This is the only possible sequence.

Example 2

stdin

1 1
0

stdout

-1

Explanation

There is no such sequence.

Log in or sign up to be able to send submissions!