atcoder#AGC002C. [AGC002C] Knot Puzzle

[AGC002C] Knot Puzzle

Problem Statement

We have NN pieces of ropes, numbered 11 through NN. The length of piece ii is aia_i.

At first, for each i(1iN1)i (1 \leq i \leq N-1), piece ii and piece i+1i+1 are tied at the ends, forming one long rope with N1N-1 knots. Snuke will try to untie all of the knots by performing the following operation repeatedly:

  • Choose a (connected) rope with a total length of at least LL, then untie one of its knots.

Is it possible to untie all of the N1N-1 knots by properly applying this operation? If the answer is positive, find one possible order to untie the knots.

Constraints

  • 2N1052 \leq N \leq 10^5
  • 1L1091 \leq L \leq 10^9
  • 1ai1091 \leq a_i \leq 10^9
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN LL

a1a_1 a2a_2 ...... ana_n

Output

If it is not possible to untie all of the N1N-1 knots, print Impossible.

If it is possible to untie all of the knots, print Possible, then print another N1N-1 lines that describe a possible order to untie the knots. The jj-th of those N1N-1 lines should contain the index of the knot that is untied in the jj-th operation. Here, the index of the knot connecting piece ii and piece i+1i+1 is ii.

If there is more than one solution, output any.

3 50
30 20 10
Possible
2
1

If the knot 11 is untied first, the knot 22 will become impossible to untie.

2 21
10 10
Impossible
5 50
10 20 30 40 50
Possible
1
2
3
4

Another example of a possible solution is 33, 44, 11, 22.