Problem:
   Problem Statement We have N pieces of ropes, numbered 1 through N . The length of piece i is a_i .  At first, for each i (1≤i≤N-1) , piece i and piece i+1 are tied at the ends, forming one long rope with N-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 L , then untie one of its knots.   Is it possible to untie all of the N-1 knots by properly applying this operation? If the answer is positive, find one possible order to untie the knots.      Constraints  2≤N≤10^5  1≤L≤10^9  1≤a_i≤10^9  All input values are integers.         Input The input is given from Standard Input in the following format:  N  L  a_1  a_2  ...  a_n       Output If it is not possible to untie all of the N-1 knots, print Impossible .  If it is possible to untie all of the knots, print Possible , then print another N-1 lines that describe a possible order to untie the knots. The j -th of those N-1 lines should contain the index of the knot that is untied in the j -th operation. Here, the index of the knot connecting piece i and piece i+1 is i .  If there is more than one solution, output any.        Sample Input 1 3 50
30 20 10      Sample Output 1 Possible
2
1  If the knot 1 is untied first, the knot 2 will become impossible to untie.       Sample Input 2 2 21
10 10      Sample Output 2 Impossible       Sample Input 3 5 50
10 20 30 40 50      Sample Output 3 Possible
1
2
3
4  Another example of a possible solution is 3 , 4 , 1 , 2 .

Solution (Python):


import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n, l = LI()
    A = LI()

    for i in range(n - 1):
        if A[i] + A[i + 1] >= l:
            k = i
            print('Possible')
            break
    else:
        print('Impossible')
        return 0

    for i in range(k):
        print(i + 1)

    for i in range(k, n - 1)[::-1]:
        print(i + 1)

    return 1


main()

Solution (Python):
n,l = map(int,input().split())
a = list(map(int,input().split()))

renzoku_length = [0]*n
last_undo = -1
for i in range(1,n):
  renzoku_length[i] = a[i]+a[i-1]
  if renzoku_length[i]>=l:
    last_undo =i
    break

if last_undo ==-1:
  print("Impossible")
  exit()

print("Possible")

for i in range(1,last_undo):
  print(i)
for i in range(last_undo+1,n)[::-1]:
  print(i)
print(last_undo)

Solution (Python):
N, L = map(int, input().split())
A = list(map(int, input().split()))


X = [A[i] + A[i + 1] for i in range(N - 1)]
if any(map(lambda x: x >= L, X)):
    print('Possible')

    for i, x in enumerate(X, start=1):
        if x >= L:
            xi = i
            break

    for i in range(1, xi):
        print(i)
    for i in reversed(range(xi + 1, N)):
        print(i)
    print(xi)

else:
    print('Impossible')

Solution (Python):
import sys
input = sys.stdin.readline
inf = float("inf")

n,L = map(int,input().split())
a = tuple(map(int,input().split()))

for i in range(1,n):
    if a[i]+a[i-1]>=L:
        print('Possible')
        for j in range(1,i):
            print(j)
        for j in range(n-1,i,-1):
            print(j)
        print(i)
        exit()

print('Impossible')

Solution (Python):
import sys
N,L=map(int,input().split())
A=[int(i) for i in input().split()]
s=10**23
for i in range(N-1):
    if A[i]+A[i+1]>=L:
        s=i
        break
if s==10**23:
    print('Impossible')
    sys.exit()
print('Possible')
L=[]
for i in range(s):
    L.append(i+1)
for i in range(N-2,s,-1):
    L.append(i+1)
L.append(s+1)

print('\n'.join(map(str,L)))

Solution (Python):
N, L = map(int, input().split())
A = list(map(int, input().split()))
pre = A[0]
index = -1
for i in range(1, N):
    if pre + A[i] >= L:
        index = i
        break
    pre = A[i]

if index == -1:
    print("Impossible")
else:
    print("Possible")
    i = 1
    while i < index:
        print(i)
        i += 1
    i = N - 1
    while index - 1 < i:
        print(i)
        i -= 1

Solution (Python):
n,l = (int(i) for i in input().split())
a = list(int(i) for i in input().split())
for i in range(n-1):
  if a[i]+a[i+1] >= l:
    print('Possible')
    for j in range(n,i+2,-1):
      print(j-1)
    for k in range(1,i+2):
      print(k)
    exit()
print('Impossible')

Solution (Python):
N, L = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
P = "Possible"
for i in range(N-1):
  if a[i] + a[i+1] >= L:
    start = i
    break  
else:
  P = "Impossible"
print(P)

if P == "Possible":
  ans = [start]
  if start > 0:
    ans += reversed(list(range(start)))
  if start != N-2:
    ans += list(range(start+1, N-1))
  ans.reverse()
  for a in ans:
    print(a+1)

Solution (Python):
n,l=map(int,input().split())
*a,=map(int,input().split())

for i in range(n-1):
  if a[i]+a[i+1]>=l:
    print("Possible")
    print(*range(i+2,n)[::-1],sep="\n")
    print(*range(1,i+2),sep="\n")
    break
else:
  print("Impossible")

Solution (Python):
n,l=map(int,input().split())
*a,=map(int,input().split())
v=[0]

for i in range(n-1):
  if a[i]+a[i+1]>=l:
    v[0]=i+1
    v+=list(range(1,i+1)[::-1])
    v+=list(range(i+2,n))
    print("Possible")
    print(*v[::-1],sep="\n")
    break
else:
  print("Impossible")

Solution (Python):
from itertools import accumulate as ac

n,l=map(int,input().split())
*a,=map(int,input().split())
v=[]

for i in range(n-1):
  if a[i]+a[i+1]>=l:
    v.append(i+1)
    break
else:
  print("Impossible")

if v:
  st=v[0]
  v+=list(range(1,st)[::-1])
  v+=list(range(st+1,n))
  print("Possible")
  for i in v[::-1]:
    print(i)

Solution (Python):
N, L = map(int, input().split())
A = [int(a) for a in input().split()]

CanRemain = []
CutFirst = []
for i in range(N-1):
    if A[i] + A[i+1] >= L: CanRemain.append(i+1)
    else: CutFirst.append(i+1)

if not CanRemain: print("Impossible")
else:
    print("Possible")
    for num in CutFirst:
        if num < CanRemain[-1]: print(num)
        else: break
    for i in reversed(range(len(CutFirst))):
        if CutFirst[i] > CanRemain[-1]: print(CutFirst[i])
        else: break
    for num in CanRemain: print(num)

Solution (Python):
n, k = map(int, raw_input().split())
l = map(int, raw_input().split())
ind = -1
for i in range(n - 1):
	if l[i] + l[i + 1] >= k:
		ind = i
		break
if ind == -1:
	print "Impossible"
else:
	print "Possible"
	for i in range(1, ind + 1):
		print i 
	for i in range(n - 1, ind, -1):
		print i

Solution (Python):
N,L=map(int,input().split())

a=list(map(int,input().split()))


for i in range(1,len(a)):
    if a[i]+a[i-1]<L:
        pass
    else:
        print("Possible")
        for j in range(1,i):
            print(j)
        for k in range(len(a)-i-1):
            print(len(a)-1-k)
        print(i)
        exit()
print("Impossible")

Solution (Python):
import sys
N,L=map(int,input().split())
A=[int(i) for i in input().split()]
flag=True
a=-1
for i in range(N-1):
    if A[i+1]+A[i]>=L:
        flag=False
        a=i+1
        break
if flag:
    print('Impossible')
    sys.exit()
print('Possible')
for i in range(1,a):
    print(i)
for i in range(N-1,a,-1):
    print(i)
print(a)

Solution (Python):
N,L=map(int,input().split())
a=[int(i) for i in input().split()]
Longest_pair=0
p=0
for i in range(N-1):
  if a[i]+a[i+1]>Longest_pair:
    Longest_pair=a[i]+a[i+1]
    p=i+1
if Longest_pair<L:
  print("Impossible")
  exit()
else:
  print("Possible")
for i in range(1,p):
  print(i)
for i in range(p+1,N)[::-1]:
  print(i)
print(p)

Solution (Python):
def inpl(): return [int(i) for i in input().split()]
import sys
N, L = inpl()
a = inpl()
b = []
for i in range(N-1):
    b.append(a[i]+a[i+1])
bmax = max(b)
if bmax < L:
    print('Impossible')
    sys.exit()

print('Possible')
ans = b.index(bmax)

Ans = list(range(0,ans)) + list(range(N-2,ans,-1))+[ans]
for i in range(N-1):
    print(Ans[i]+1)

Solution (Python):
N,L=map(int,input().split())
a=[int(i) for i in input().split()]
j=-1
for i in range(N-1):
    if a[i]+a[i+1]>=L:
        j=i
        break
if j==-1:
    print("Impossible")
else:
    print("Possible")
    for i in range(j):
        print(i+1)
    for i in range(j+1,N-1)[::-1]:
        print(i+1)
    print(j+1)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,l = li()
a = list(li())

exist = False

for i, (ap, an) in enumerate(zip(a[:-1], a[1:])):
    if ap + an >= l:
        bef = [j+1 for j in range(i)]
        aft = [j+1 for j in range(n-2,i,-1)]
        ans = bef + aft + [i+1]
        exist = True
        break

if exist:
    print("Possible")
    for ai in ans:
        print(ai)

else:
    print("Impossible")

Solution (Python):
N, L = map(int, input().split())
a = list(map(int, input().split()))
end = 0
for i in range(N - 1):
    if a[i] + a[i + 1] >= L:
        end = i + 1
        break
else:
    print('Impossible')
    exit()

ans = list(range(1, end)) + list(range(end, N))[::-1]
print('Possible')
print(*ans, sep='\n')

Solution (Python):
n,l=map(int, input().split())
a=list(map(int, input().split()))
ans=-1
for i in range(n-1):
    if a[i]+a[i+1]>=l:
        ans=i+1
        break
if ans==-1:print('Impossible')
else:
    print('Possible')
    for i in range(1,ans):print(i)
    for i in range(n-1,i,-1):print(i)

Solution (Python):
n, l = map(int, input().split())
a = list(map(int, input().split()))

atom = -1
for i in range(n-1):
    if l <= a[i] + a[i+1]:
        atom = i
        break
        
if atom < 0:
    print('Impossible')
else:
    print('Possible')
    for i in range(atom):
        print(i+1)
    for i in range(n-atom-1):
        print(n-1-i)

Solution (Python):
ai = lambda: list(map(int, input().split()))

n,l = ai()
a = ai()

f = 0
for i in range(1,n):
    if a[i-1]+a[i] >= l:
        f = 1
        key = i
        break
if f:
    print('Possible')
    b = list(range(n))
    c = b[1:key]
    c += b[-1:key:-1]
    c += [key]
    print(*c, sep='\n')
else:
    print('Impossible')

Solution (Python):
n,l=map(int,input().split())
a = [int(x) for x in input().split()]
for i in range(1,n):
    if a[i-1] +a[i]>= l:
        print("Possible")
        for j in range(1,i):
            print(j)
        for j in range(n-1,i-1,-1):
            print(j)
        break
else:
    print("Impossible")

Solution (Python):


INF = float('inf')


def inpl(): return list(map(int, input().split()))


N, L = inpl()
A = inpl()

tmp = 0
connect = False
knot = None
for i in range(N):
    if A[i] >= L:
        knots = i
        break

if knot is None:
    for i in range(N - 1):
        if sum(A[i:i + 2]) >= L:
            knot = i
            connect = True
            break

if knot is None:
    print('Impossible')
else:
    print('Possible')
    for i in range(N - 1):
        if i == knot:
            break
        else:
            print(i + 1)

    for i in range(N - 2, -1, -1):
        if i == knot:
            break
        else:
            print(i + 1)
    if connect:
        print(knot + 1)

Solution (Python):
N, L, *a = map(int, open(0).read().split())
for i, (n, m) in enumerate(zip(a, a[1:]), 1):
    if n + m >= L:
        print('Possible')
        print('\n'.join(c for it in (range(1,i), range(N-1,i,-1), [i]) for c in map(str, it)))
        break
else:
    print('Impossible')

Solution (Python):
n,l = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
s,x,y,ans,num,z = sum(a),0,n-1,[],0,0
for i in range(n-1):
	num2 = a[i]+a[i+1]
	if num<num2: num,z = num2,i+1
if num>=l:
	print("Possible")
	for i in range(1,z): print(i)
	for i in range(n-1,z-1,-1): print(i)
else: print("Impossible")

Solution (Python):
def main22():
    strbuf = input("");
    strbufs = strbuf.split();
    buf = [];
    for i in range(2):
        buf.append(int(strbufs[i]));
    strbuf = input("");
    strbufs = strbuf.split();
    buf2 = [];
    for i in range(buf[0]):
        buf2.append(int(strbufs[i]));
    if buf[0] == 2:
        if buf2[0] + buf2[1] >= buf[1]:
            print("Possible");
            print(1);
        else:
            print("Impossible");
    else:
        point = -1;
        for i in range((buf[0] - 1)):
            if buf2[i] + buf2[i+1] >= buf[1]:
                point = i+1;
                break;
        if point == -1:
            print("Impossible");
        else:
            print("Possible");
            if point != 1:
                for i in range(point-1):
                    print(i+1);
            if point != buf[0] - 1:
                for i in range(buf[0]-1,point,-1):
                    print(i);
            print(point);

if __name__ == '__main__':
    main22()

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N,L = inpl()
aa = inpl()
tmp = 0
for i in range(N-1):
	if aa[i] + aa[i+1] >= L:
		tmp += 1
		ind = i+1

if tmp == 0:
	print('Impossible')
else:
	print('Possible')
	for i in range(1,ind):
		print(i)
	for i in reversed(range(ind,N)):
		print(i)

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, L, A):

    for i in range(N-1):
        if A[i] + A[i+1] >= L:
            print('Possible')
            for j in range(i):
                print(j+1)
            for j in reversed(range(i+1, N-1)):
                print(j+1)
            print(i+1)
            return

    else:
        print('Impossible')


def main():
    N, L = read_int_n()
    A = read_int_n()
    slv(N, L, A)


if __name__ == '__main__':
    main()

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, L, A):

    for i in range(N-1):
        if A[i] + A[i+1] >= L:
            print('Possible')
            for j in range(i):
                print(j+1)
            for j in reversed(range(i+1, N-1)):
                print(j+1)
            print(i+1)
            return

    else:
        print('Impossible')


def main():
    N, L = read_int_n()
    A = read_int_n()
    slv(N, L, A)


if __name__ == '__main__':
    main()

Solution (Python):
N, L = map(int, input().split())
As = list(map(int, input().split()))

for iKnot in range(1, N):
    if As[iKnot - 1] + As[iKnot] >= L:
        print('Possible')
        for i in range(1, iKnot):
            print(i)
        for i in reversed(range(iKnot + 1, N)):
            print(i)
        print(iKnot)
        break
else:
    print('Impossible')

Solution (Python):
N,L=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]

res=-1
for i in range(N-1):
	if A[i]+A[i+1]>=L:
		res=i
		break
if res!=-1:
	print("Possible")
	for i in range(res):
		print(i+1)
	for i in range(N-1,res,-1):
		print(i)
else:
	print("Impossible")

Solution (Python):
N, L = map(int, input().split())
A = list(map(int, input().split()))

for i in range(1, N):
    if A[i-1] + A[i] >= L:
        X = i
        break
else:
    print("Impossible")
    exit()

print("Possible")
for i in range(1, X):
    print(i)
for i in range(N-1, X-1, -1):
    print(i)

Solution (Python):
N, L = map(int, input().split())
A = list(map(int, input().split()))

for i in range(1, N):
    if A[i-1] + A[i] >= L:
        X = i
        break
else:
    print("Impossible")
    exit()

print("Possible")
for i in range(1, X):
    print(i)
for i in range(N-1, X, -1):
    print(i)
print(X)

Solution (Python):
N, L = map(int, input().split())
A = list(map(int, input().split()))

for i in range(1, N):
    if A[i-1] + A[i] >= L:
        X = i
        break
else:
    print("Impossible")
    exit()

ans = []
for i in range(1, X):
    ans.append(i)
for i in range(N-1, X, -1):
    ans.append(i)
ans.append(X)
print("Possible")
print(*ans, sep="\n")

Solution (Python):
N, L = map(int, input().split())
A = list(map(int, input().split()))
p = 0
for i in range(N-1):
    if A[i] + A[i+1] >= L:
        p = i
        break
else:
    print("Impossible")
    exit()
print("Possible")
for i in range(1, p+1):
    print(i)
for i in range(N-1, p, -1):
    print(i)

Solution (Python):
n, l = map(int, input().split())
a = list(map(int, input().split()))

if n == 2:
	if a[0] + a[1] < l:
		print("Impossible")
	else:
		print("Possible")
		print(1)

else:
	nagai = 0
	for i in range(n - 1):
		if a[i] + a[i + 1] > nagai:
			nagai = a[i] + a[i + 1]
			nagai_index = i + 1

	if nagai < l:
		print("Impossible")
	else:
		print("Possible")
		for i in range(1, nagai_index):
			print(i)
		for i in range(n - 1, nagai_index, -1):
			print(i)
		print(nagai_index)

Solution (Python):


N, L = map(int, input().split())
a = list(map(int, input().split()))

sums = [a[i]+a[i+1] for i in range(N-1)]

maxind, maxval = max(enumerate(sums), key=lambda x:x[1])
if maxval >= L:
    print("Possible")
    for i in range(maxind):
        print(i+1)
    for j in reversed(range(maxind, N-1)):
        print(j+1)
else:
    print("Impossible")

Solution (Python):
N, L = map(int, input().split())
a = list((map(int, input().split())))
longest = 0
longest_i = N
for i in range(N-1):
    knot = a[i]+a[i+1]
    if knot > longest:
        longest = knot
        longest_i = i+1
if longest < L:
    print("Impossible")
else:
    print("Possible")
    for i in range(1,longest_i):
        print(i)
    for j in range(N-1,longest_i-1,-1):
        print(j)

Solution (Python):
n,l = map(int,input().split())
a = list(map(int,input().split()))
for i in range(1,n):
	if a[i-1] + a[i] >= l:
		print("Possible")
		for j in range(1,i,1):
			print(j)
		for j in range(n-1,i-1,-1):
			print(j)
		break
else:
	print("Impossible")

Solution (Python):
def cutSequence(piles, threshold):
    for i in xrange(len(piles)-1):
        if piles[i]+piles[i+1]>=threshold:
            return range(0, i)+range(len(piles)-2, i-1, -1)
    return []

def main():
    n, m = [int(x) for x in raw_input().strip().split()]
    a = [int(x) for x in raw_input().strip().split()]
    foo = cutSequence(a, m)
    if len(foo)==0:
        print 'Impossible'
    else:
        print 'Possible'
        for x in foo:
            print x+1

if __name__ == '__main__':
    main()

Solution (Python):
N,L=map(int,input().split())
A=[int(x) for x in input().split()]

psbl=False
ans=0
for i in range(1,N):
  if A[i-1]+A[i]>=L:
    psbl=True
    ans=i-1
    break
if psbl==False:
  print("Impossible")
else:
  print("Possible")
  for i in range(ans):
    print(i+1)
  for j in range(N-1-ans):
    print(N-j-1)

Solution (Python):
N,L = map(int,input().split())
src = list(map(int,input().split()))

for i,(a,b) in enumerate(zip(src, src[1:])):
    if a+b >= L:
        print('Possible')
        for j in range(1,i+1): print(j)
        for j in range(N-1,i,-1): print(j)
        exit()
print('Impossible')

Solution (Python):
import sys
N, L =map(int,input().split())
a = list(map(int,input().split()))
for i in range(N-1):
  if a[i]+a[i+1] >= L:
    flag = i+1
    break
else:
  print("Impossible")
  sys.exit()

print("Possible")
for i in range(1,flag):
  print(i)
for i in range(N-1,flag-1,-1):
  print(i)

Solution (Python):
def dump(n,k):
  for i in range(k-1):
    print(i+1)
  for i in range(n-1,k-1,-1):
    print(i)

n,l=map(int,input().split(' '))
a=input().split(' ')
a=[int(s) for s in a]

k=0
for i in range(n-1):
  if a[i]+a[i+1]>=l:
    k=i+1
    break

if k==0:
  print("Impossible")
else:
  print("Possible")
  dump(n,k)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    N, L = map(int, input().split())
    a_list = list(map(int, input().split()))

    for i in range(N - 1):
        if a_list[i] + a_list[i + 1] >= L:
            break
    else:
        print("Impossible")
        return

    print("Possible")
    for x in range(1, i + 1):
        print(x)
    for x in range(N - 1, i, -1):
        print(x)


if __name__ == '__main__':
    main()

Solution (Python):
N,L = list(map(int,input().split()))
a = list(map(int,input().split()))
a.append(0)
b = []
res = "Impossible"

for i in range(N):
    if L <= (a[i]+a[i+1]):
        count = i
        res = "Possible"
        break

if res =="Possible":
    for j in range(count):
        b.append(j+1)
    for k in range(count+1,N)[::-1]:
        b.append(k)
    
    print(res)
    for l in range(len(b)):
        print(b[l])
else:
    print(res)

Solution (Python):
temp=input().split()
N=int(temp[0])
L=int(temp[1])
a=[int(i) for i in input().split()]
flag=False
ans=[]

for i in range(N-1):
	if a[i]+a[i+1]>=L:
		print("Possible")
		flag=True
		ans.append(i)
		break
else:
	print("Impossible")

if flag==True:
	while ans[-1]>0:
		ans.append(ans[-1]-1)
	if ans[0]<N-1:
		ans.append(ans[0]+1)
		while ans[-1]<N-2:
			ans.append(ans[-1]+1)
	for i in range(N-2,-1,-1):
		print(ans[i]+1)

Solution (Python):
import numpy as np

n, l = map(int, input().split())
knot = list(map(int, input().split()))

flg = 0
li = []
for i in range(0, int(n) - 1):
    if(knot[i] + knot[i + 1] >= l):
        flg = 1
        print("Possible")
        li.append(i + 1)

        for j in range(i + 2, n):
            li.append(j)
        for j in reversed(range(1, i + 1)):
            li.append(j)
        break

if flg == 0:
    print("Impossible")

for i in reversed(li):
    print(i)

Solution (Python):
N, L = map(int, input().split())
a = list(map(int, input().split()))
max_value = max_value_index = 0
for index, i in enumerate(zip(a[:-1], a[1:])):
    if max_value < sum(i):
        max_value = sum(i)
        max_value_index = index

print("Possible\n" + "\n".join([str(i) for i in range(1, max_value_index + 1)] + [str(i) for i in range(N - 1, max_value_index, -1)]) if max_value >= L else "Impossible")

Solution (Python):
import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)
 

def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())

 
def join(s):
    return ''.join(s)
 

def memoize(f):
    cache = {}
    def helper(*args):
        if args not in cache:
            cache[(args)] = f(*args)
        return cache[args]
    return helper
 
nh=zip([1,0,-1,0],[0,1,0,-1])
INF = float('inf')
mod=1000000007
 


n,l=ii()
a=ii()
p=-1
for j in range(n-1):
    if a[j]+a[j+1]>=l:
        p=j

if p==-1:
    print "Impossible"
else:
    print "Possible"
    x=[p+1]
    for j in range(p+2,n):
        x.append(j)
    for j in reversed(range(1,p+1)):
        x.append(j)
    x.reverse()
    for j in x:
        print j

Solution (Python):
N, L = list(map(int, input().split()))
As = list(map(int, input().split()))

sumL = sum(As)

l,r = 0, N-1
ans = []
cnt = 0

center = -1
for i in range(N-1):
    if As[i]+As[i+1]>=L:
        center = i+1
        break
if center < 0:
    print('Impossible')
else:
    print('Possible')
    for i in range(center-1):
        print(i+1)
    for i in range(N-1, center, -1):
        print(i)
    print(center)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    n,l = list(map(int, input().split()))
    a = list(map(int, input().split()))
    g = 0
    for i in range(1,n):
        if a[i] + a[i-1] >= l:
            g = i
            break
    if g == 0:
        print('Impossible')
        return
    print('Possible')
    for i in range(1,g):
        print(i)
    for i in range(n-1,g-1,-1):
        print(i)

f()

Solution (Python):
NL = input()
NL = "".join(NL).rstrip("\n").split(" ")
N = int(NL[0])
L = int(NL[1])
a = input()
a = "".join(a).split(" ")

for s in range(N-1):
	if int(a[s])+int(a[s+1])>=L:
		Last = s+1
		print("Possible")
		for s in range(N-1):
			if s+1>Last:
				for j in range(N):
					if (N-1-j) ==s:
						
						break
					print(N-1-j)
				break
			if s+1==Last:
				continue
			print(s+1)
		print(Last)
		break
	if s==N-2:
		print("Impossible")

Solution (Python):
N, L = map(int, input().split())
A = list(map(int, input().split()))
flg = False
for i in range(N - 1):
    if A[i] + A[i+1] >= L:
        flg = True
        break
if not flg:
    print("Impossible")
    exit()
else:
    print("Possible")

for j in range(i):
    print(j + 1)
for j in range(N - 1, i + 1, -1):
    print(j)
print(i + 1)

Solution (Python):



def solve(n, l, xs):
    pair_idx = None
    for i in range(n - 1):
        if xs[i] + xs[i + 1] >= l:
            pair_idx = i
            break
    if pair_idx is None:
        return (False, [])
    ans = [x + 1 for x in range(pair_idx)]
    ans.extend(x + 1 for x in range(pair_idx + 1, n - 1)[::-1])
    ans.append(pair_idx + 1)
    return (True, ans)


def main():
    n, l = map(int, input().split())
    xs = list(map(int, input().split()))
    judge, ans = solve(n, l, xs)
    if not judge:
        print("Impossible")
        return
    print("Possible")
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()

Solution (Python):
n, l = map(int, raw_input().split())
A = map(int, raw_input().split())

for i in xrange(n-1):
    if A[i]+A[i+1] >= l:
        print "Possible"
        print "\n".join(map(str, range(1, i+1) + range(n-1, i+1, -1) + [i+1]))
        break
else:
    print "Impossible"

Solution (Python):
def main():
    n, l = (int(s) for s in input().strip().split(' '))
    an = [int (s) for s in input().strip().split(' ')]
    for i in range(1, n):
        if an[i-1] + an[i] >= l:
            print('Possible')
            index = i
            break
    else:
        print('Impossible')
        return
    for i in range(1, index):
        print(i)
    for i in range(n-1, index, -1):
        print(i)
    print(index)
 
main()

Solution (Python):
def main():
    n, l = (int(s) for s in input().strip().split(' '))
    an = [int (s) for s in input().strip().split(' ')]
    for i in range(1, n):
        if an[i-1] + an[i] >= l:
            print('Possible')
            index = i
            break
    else:
        print('Impossible')
        return
    for i in range(1, index):
        print(i)
    for i in range(n-1, index, -1):
        print(i)
    print(index)

main()

Solution (Python):
n,l=map(int,raw_input().split())
a=map(int,raw_input().split())
fknot=0
for i in xrange(n-1):
    if a[i]+a[i+1]>=l:
        fknot=i+1
if fknot==0:
    print("Impossible")
else:
    print("Possible")
    for i in xrange(n-1,fknot,-1):
        print(i)
    for i in xrange(1,fknot):
        print(i)
    print(fknot)

Solution (Python):
import re

class IO_for_Contest(object):
    @staticmethod
    def my_input():
        
        return input()

    @staticmethod
    def read_from_input():
        n, l = IO_for_Contest.read_n_int(2)
        a = IO_for_Contest.read_n_int(n)
        return l, a

    @staticmethod
    def read_line():
        return IO_for_Contest.my_input().strip()

    @staticmethod
    def read_int():
        return int(IO_for_Contest.my_input().strip())

    @staticmethod
    def read_n_int(n):
        return list(map(int, re.split('\W+', IO_for_Contest.my_input().strip())))[ : n]


def solve():
    l, a = IO_for_Contest.read_from_input()
    result = find_way_how_to_split_ropes(l, a)
    if result is None:
        print('Impossible')
    else:
        print('Possible')
        for x in result:
            print(x)

def find_way_how_to_split_ropes(l, a):
    adjencent_sum = []
    for i in range(len(a) - 1):
        adjencent_sum.append(a[i] + a[i + 1])
    if max(adjencent_sum) < l:
        return None
    x = 0
    result = []
    for y in range(len(adjencent_sum)):
        if adjencent_sum[y] >= l:
            x = y + 1
            break
        result += [y + 1]
    for y in range(len(adjencent_sum) - 1, x - 1, -1):
        result += [y + 1]
    result += [x]
    return result

if __name__ == '__main__':
    solve()

Solution (Python):
def read_data():
    N, L = map(int, input().split())
    As = list(map(int, input().split()))
    return N, L, As

def solve(N, L, As):
    for i in range(N - 1):
        if As[i] + As[i + 1] >= L:
            return list(range(1, i + 1)) + list(range(N - 1, i, - 1))
    return []

N, L, As = read_data()
ans = solve(N, L, As)
if ans:
    print("Possible")
    for i in ans:
        print(i)
else:
    print("Impossible")

Solution (Python):
N, L = map(int, raw_input().split())
A = map(int, raw_input().split())

k = None
for i in range(N-1):
    if A[i] + A[i+1] >= L:
        k = i
        break
    
if k is None:
    print "Impossible"
else:
    print "Possible"
    for j in range(1,k+1):
        print j
    for j in range(N-1, k, -1):
        print j

Solution (Python):
n,l=map(int,input().split())
arr=list(map(int,input().split()))
psbl=False
pos=0
for i in range(n-1):
    if arr[i]+arr[i+1]>=l:
        psbl=True
        pos=i
        break
if psbl:
    print("Possible")
    for i in range(0,pos):
        print(i+1)
    for i in range(n-2,pos,-1):
        print(i+1)
    print(pos+1)
else:
    print("Impossible")