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):
N,L = map(int,input().split())
A = list(map(int,input().split()))

for i,(a,b) in enumerate(zip(A,A[1:])):
    if a+b >= L:
        print('Possible')
        break
else:
    print('Impossible')
    exit()
ans = []
for j in range(1,i+1):
    ans.append(j)
for j in range(N-1,i+1,-1):
    ans.append(j)
ans.append(i+1)
print(*ans, sep='\n')

Solution (Python):

def knot(N, L, a):
    res = []
    for i in range(N - 1):
        if a[i] + a[i + 1] >= L:
            res.append(i + 1)
            start = i
            break
    else:
        return res

    for i in range(start + 1, N - 1):
        res.append(i + 1)
    for i in range(start - 1, -1, -1):
        res.append(i + 1)
    return res


if __name__ == "__main__":
    N, L = map(int, input().split())
    a = list(map(int, input().split()))
    knot = knot(N, L, a)
    if not knot:
        print("Impossible")
    else:
        print("Possible")
        print(*knot[::-1], sep="\n")

Solution (Python):
import sys
input = sys.stdin.readline
N, L = map(int, input().split())
a = list(map(int, input().split()))
s = -1
for i in range(N - 1):
  if a[i] + a[i + 1] >= L:
    s = i
    break
if s == -1:
  print("Impossible")
  exit(0)
res = [s]
for i in range(s - 1, -1, -1):
  res.append(i)
for i in range(s + 1, N - 1):
  res.append(i)
res.reverse()
print("Possible")
for r in res: print(r + 1)

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy


from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) 
def inpm(): return map(int,input().split()) 
def inpl(): return list(map(int, input().split())) 
def inpls(): return list(input().split())  
def inplm(n): return list(int(input()) for _ in range(n)) 
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) 
 
def main():
    n,l = inpm()
    a = inpl()
    ans = []
    for i in range(n-1):
        if a[i]+a[i+1] >= l:
            x = i+1
            ans.append(i+1)
            break
    if ans == []:
        print('Impossible')
    else:
        print('Possible')
        for i in range(x+1,n):
            ans.append(i)
        for i in range(x-1,0,-1):
            ans.append(i)
        ans.reverse()
        for i in range(len(ans)):
            print(ans[i])
    
if __name__ == "__main__":
    main()

Solution (Python):
N, L = map(int, input().split())
A = list(map(int, input().split()))
d = [A[i] + A[i+1] for i in range(N-1)]
if max(d) < L:
  print("Impossible")
else:
  print("Possible")
  j = 0
  while d[j] < L:
    j += 1
  for i in range(j):
    print(i+1)
  for i in range(j, N-1):
    print(N-i+j-1)

Solution (Python):

def know(N, K, A):
    isOK = False
    for i in range(1, N):
        if A[i] + A[i - 1] >= K:
            isOK = True
            first = i

    if not isOK:
        return ["Impossible"]

    ans = [first]
    for i in range(first + 1, N):
        ans.append(i)
    for i in range(first - 1, 0, -1):
        ans.append(i)
    return ["Possible"] + ans[::-1]


if __name__ == "__main__":
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    ans = know(N, K, A)
    print(*ans, sep="\n")

Solution (Python):
import heapq
N, K = map(int, input().split())
A = list(map(int, input().split()))

knot = []
for i in range(N - 1):
    heapq.heappush(knot, (-A[i]-A[i+1], i))

ans = []
seen = [False]*N
while knot:
    L, i = heapq.heappop(knot)
    L = -L

    if seen[i]:
        continue
    if L < K:
        break

    seen[i] = True
    ans.append(i + 1)

    if i + 1 < N - 1:
        heapq.heappush(knot, (-L - A[i + 1], i + 1))
    if i - 1 >= 0:
        heapq.heappush(knot, (-L - A[i - 1], i - 1))

if len(ans) != N - 1:
    print("Impossible")
else:
    print("Possible")
    print(*ans[::-1], sep="\n")

Solution (Python):
def main():
    N,L = [int(n) for n in input().split()]
    A = [int(n) for n in 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")
        return
    print("Possible")
    for j in range(1,i+1):
        print(j)
    for j in reversed(range(i+2,N)):
        print(j)
    print(i+1)
main()

Solution (Python):
n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
  if a[i]+a[i+1] >= k:
    print("Possible")
    x = i
    break
else:
  print("Impossible")
  exit()
if x == 0:
  print(*list(range(1,n))[::-1],sep="\n")
else:
  ans = list(range(1,n))
  ans[x:] = ans[n-1:x-1:-1]
  print(*ans,sep="\n")

Solution (Python):
N, L = map(int, input().split())
A = [int(a) for a 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):
            print(j)
        print(i)
        break
else:
    print("Impossible")

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

Solution (Python):
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:
    f = i+1
    break
else:
  print("Impossible")
  exit()
print("Possible")
for i in range(1, f):
  print(i)
for i in range(n-1, f, -1):
  print(i)
print(f)

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

junban=[]
flg=False

for i in range(N-1):
    if A[i]+A[i+1]>=L:
        tmp=i
        flg=True


if flg:
    print("Possible")
    for i in range(N-1):
        if tmp>i:
            print(i+1)
        else:
            print(N+tmp-i-1)
else:
    print("Impossible")

Solution (Python):

N, L = map(int, input().split())
A = list(map(int, input().split()))
flag = True
l = -1
for i in range(N-1):
    if A[i] + A[i+1] >= L:
        l = i+1
if l < 0:
    print("Impossible")
    exit()
knot = list(range(1, N))
print("Possible")
idx = 1
while idx < l:
    print(idx)
    idx += 1
idx = N-1
while idx > l:
    print(idx)
    idx -= 1
print(l)

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

last = -1
for i in range(n-1):
    if A[i] + A[i+1] >= l:
        last = i
        break

if last == -1:
    print("Impossible")
else:
    print("Possible")
    for i in range(last):
        print(i+1)
    for i in range(n-2, last-1, -1):
        print(i+1)

Solution (Python):
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:
        print('Possible')
        
        ans = []
        
        for j in range(1, i+1):
            ans.append(j)
        
        for j in range(N-1, i+1, -1):
            ans.append(j)
        
        ans.append(i+1)
        
        for ans_i in ans:
            print(ans_i)
        
        break
else:
    print('Impossible')

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


i = 0
flag = False
while i < N - 1:
    if a[i] + a[i + 1] >= L:
        flag = True
        break
    i += 1

if not flag:
    print ('Impossible')
else:
    print ('Possible')
    for j in range(i):
      print (j + 1)
    for j in range(N - 1, i, -1):
      print (j)

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


i = 0
flag = False
while i < N - 1:
    if a[i] + a[i + 1] >= L:
        flag = True
        break
    i += 1

if not flag:
    print ('Impossible')
else:
    print ('Possible')
    if i > 0:
        for j in range(i):
            print (j + 1)
    for j in range(N - 1, i, -1):
        print (j)

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

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

if memo == -1:
    print("Impossible")
else:
    print("Possible")
    for i in range(memo):
        print(i+1)
    for i in range(n-2,memo-1,-1):
        print(i+1)

Solution (Python):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, l = list(map(int, readline().split()))
    a = collections.deque(list(map(int, readline().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")


if __name__ == '__main__':
    solve()

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools




N,L,*A = map(int,read().split())

S = [0] + [x+y for x,y in zip(A,A[1:])]
M = max(S)
i = S.index(M)

if M < L:
    print('Impossible')
    exit()

answer = list(itertools.chain(range(i,0,-1),range(i+1,N)))[::-1]
print('Possible')
print('\n'.join(map(str,answer)))

Solution (Python):
def s():
	n, l, *a = map(int, open(0).read().split())
	for i, (x, y) in enumerate(zip(a, a[1:])):
		if x + y >= l:
			print("Possible")
			r = list(range(n))
			print("\n".join(map(str, r[1:i + 1] + r[n:i:-1])))
			break
	else:
		print("Impossible")
if __name__=="__main__":
	s()

Solution (Python):
n,l,*a=map(int,open(0).read().split())
for i,(x,y) in enumerate(zip(a,a[1:])):
	if x+y>=l:
		print("Possible")
		r=list(range(n))
		print("\n".join(map(str,r[1:i+1]+r[n:i:-1])))
		exit()
print("Impossible")

Solution (Python):
def examA():
    a, b = LI()
    if a>0:
        ans = "Positive"
        print(ans)
        return
    if b>=0:
        ans = "Zero"
    else:
        judge = b-a
        if judge%2==1:
            ans = "Positive"
        else:
            ans = "Negative"
    print(ans)
    return

def examB():
    N, M = LI()
    boal = [1]*N
    d = defaultdict(bool)
    d[0] = True
    for _ in range(M):
        x,y = LI()
        boal[x-1] -=1
        boal[y-1] +=1
        if d[x-1]:
            d[y-1] = True
        if boal[x-1]==0:
            d[x-1] = False
    ans = sum(d.values())
    print(ans)
    return

def examC():
    N, L = LI()
    A = LI(); cur = -1
    ans = "Impossible"
    for i in range(N-1):
        if A[i]+A[i+1]>=L:
            ans = "Possible"
            cur = i
            break
    print(ans)
    if cur==-1:
        return
    ansC = []
    for i in range(cur):
        ansC.append(i)
    for i in range(N-2,cur,-1):
        ansC.append(i)
    ansC.append(cur)
    for v in ansC:
        print(v+1)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()

Solution (Python):

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

flag = False
for i in range(N-1):
    if A[i] + A[i+1] >= L:
        importance_i = i
        flag = True
        break
if not flag:
    print("Impossible")
    exit()

l, r = 0, N-1
print("Possible")
ans = []
while r - l > 1:
    
    if l < importance_i:
        ans.append(l+1)
        l += 1
    if r > importance_i+1:
        ans.append(r)
        r -= 1

ans.append(importance_i+1)
print(*ans, sep="\n")

Solution (Python):
import sys
import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) 
rs = lambda: stdin.readline().rstrip()  
sys.setrecursionlimit(10 ** 7)

N, L = rl()
A = np.array(rl())
couple = A[:-1] + A[1:]
if couple.max() < L:
    print('Impossible')
    exit()
print('Possible')
index = np.nonzero(couple>=L)[0][0] + 1
for i in range(1, N):
    if i == index:
        break
    print(i)
for i in range(N-1, 0, -1):
    if i == index:
        break
    print(i)

print(index)

Solution (Python):
n,l = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

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

if index==0:
    print("Impossible")
else:
    print("Possible")
    for i in range(1,index):
        print(i)
    for i in range(n-1,index,-1):
        print(i)
    print(index)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    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):
            print("Possible")
            break
    else:
        print("Impossible")
        return

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

Solution (Python):
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



N, L = list(map(int, sys.stdin.buffer.readline().split()))
A = list(map(int, sys.stdin.buffer.readline().split()))

A = np.array(A, dtype=int)

s = A[1:] + A[:-1]

if s.max() >= L:
    print('Possible')
    last = s.argmax()
    ans = list(range(N - 1))
    for i in range(last):
        print(i + 1)
    for i in reversed(range(last + 1, N - 1)):
        print(i + 1)
    print(last + 1)
else:
    print('Impossible')

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

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

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


if imp==0:
    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):
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:
        print('Possible')
        ans = list(range(1,i+1))+list(range(i+2,n))[::-1]
        ans.append(i+1)
        for i in ans:
            print(i)
        exit()
print('Impossible')

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

Solution (Python):
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors







n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
maxv=0
maxid=-1
for i in range(n-1):
    if(maxv<a[i]+a[i+1]):
        maxv=a[i]+a[i+1]
        maxid=i+1

if(maxv<k):
    print("Impossible")
    exit()
print("Possible")
for j in range(maxid-1):
    print(j+1)
    
for j in range(n-maxid-1):
    print(n-1-j)
    
print(maxid)

Solution (Python):
N, L = map(int, input().split())
a = [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(i) :
            print(j + 1)
        for j in range(N - 2, i, -1) :
            print(j + 1)
        print(i + 1)
        break
else :
    print('Impossible')

Solution (Python):

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

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

flag = False
able = 0
for i in range(N-1):

    if a[i] + a[i+1] >= L:
        flag = True
        able = i
        break

if flag:

    print ("Possible")

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

    for i in range(N-1-able):
        print (N-1-i)

    

else:
    print ("Impossible")

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

Solution (Python):
import numpy as np
n,l=map(int,input().split())
a=list(map(int,input().split()))
flag=False;idx=0
for i in range(n-1):
  if a[i]+a[i+1]>=l:
    flag=True
    idx=i
if not flag:
  print("Impossible")
  exit(0)
print("Possible")
for x in range(idx):
  print(x+1)
for x in reversed(range(idx,n-1)):
  print(x+1)

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

ok = 0
for i in range(1, N):
    if a[i-1] + a[i] >= L:
        ok = 1
        break

if ok:
    print('Possible')
    for j in range(1, i):
        print(j)
    for j in range(N-1, i, -1):
        print(j)
    print(i)
else:
    print('Impossible')

Solution (Python):


from itertools import tee


def pairwise(iterable):
    "s -> (s0,s1), (s1,s2), (s2, s3), ..."
    a, b = tee(iterable)
    next(b, None)
    return zip(a, b)


def solve(N, L, a):
    for knot, pair in enumerate(pairwise(a), 1):
        if sum(pair) >= L:
            break
    else:
        return []
        

    ans = []
    for i in range(1, knot):
        ans.append(i)
    for i in range(N - 1, knot - 1, - 1):
        ans.append(i)
    return ans


if __name__ == '__main__':
    N, L = map(int, input().split())
    a = tuple(map(int, input().split()))
    ans = solve(N, L, a)
    if ans:
        print('Possible')
        print(*ans, sep='\n')
    else:
        print('Impossible')

Solution (Python):
N,L = map(int,input().split())
a = list(map(int,input().split()))
x = N
for i in range(1,N):
    if a[i] + a[i-1] >= L:
        x = i
if x == N:
    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()))

r = [0]
for i in range(n):
    r.append(r[i] + a[i])

ansl = []
p,q = 0,n-1
suma = sum(a)
while p < q:
    if r[q+1] - r[p]  < L:
        print("Impossible")
        exit()
    if a[p] + a[p + 1] <= a[q-1] + a[q]:
        ansl.append(p + 1)
        p+=1
    else:
        ansl.append(q)
        q-=1


print("Possible")
for ans in ansl:
    print(ans)

Solution (Python):
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:
    print("Possible")
    for j in range(i):print(j+1)
    for j in range(n-1,i,-1):print(j)
    exit()
print("Impossible")

Solution (Python):
import sys
input = sys.stdin.buffer.readline
N, L = map(int, input().split())
a = list(map(int, input().split()))
res = []
for i in range(N - 1):
  if a[i] + a[i + 1] >= L:
    res.append(i + 1)
    break
if len(res):
  i = res[0] - 1
  while i > 0:
    res.append(i)
    i -= 1
  i = res[0] + 1
  while i < N:
    res.append(i)
    i += 1
  print("Possible")
  for i in range(N - 2, -1, -1):
    print(res[i])
else:
  print("Impossible")

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

s = 0
for i in range(N-1):
    if A[i] + A[i+1] > s:
        s = A[i] + A[i+1]
        ind = i

if s < L:
    print('Impossible')
else:
    print('Possible')
    for i in range(N-1):
        if i == ind:
            break
        print(i+1)
    for i in reversed(range(N-1)):
        if i == ind:
            break
        print(i+1)
    print(ind+1)

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

if N==2:
    if sum(A)>=L:
        print("Possible")
        print("1")
        exit()
    else:
        print("Impossible")
        exit()
ans=[]
for i in range(N-1):
    if A[i]+A[i+1]>=L:
        last=i
        for j in range(i):
            ans.append(j)
        for j in range(N-2,i,-1):
            ans.append(j)
        break

if len(ans)==0:
    print("Impossible")
    exit()

ans.append(last)

print("Possible")
for i in range(N-1):
    print(ans[i]+1)

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

pos = -1

for i in range(n-1):
    if a[i] + a[i+1] >= l:
        pos = i
        break
if pos == -1:
    print('Impossible')
    exit()

print('Possible')
for i in range(pos):
    print(i+1)

for i in reversed(range(pos+1,n-1)):
    print(i+1)

print(pos+1)

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

check_min = 0
index_min = n

for i in range(n-1):
    if check_min < a[i] + a[i+1]:
        check_min = a[i] + a[i+1]
        index_min = i

if check_min < l:
    print('Impossible')
else:
    print('Possible')
    for i in range(index_min):
        print(i+1)
    for i in range(n-2, index_min, -1):
        print(i+1)
    print(index_min+1)

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

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

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

Solution (Python):
n,l,*a=map(int,open(0).read().split())
ans=[]    
for i in range(1,n):
    if a[i]+a[i-1]<l:
        ans.append(i)
    else:
        for j in range(n-1,i-1,-1):
            ans.append(j)
        print("Possible")
        print(*ans,sep="\n")
        exit()
print("Impossible")

Solution (Python):
from collections import deque
N, L = map(int, input().split())
c = list(map(int, input().split()))
for i in range(len(c)-1):
  if c[i] + c[i+1] >= L:
    pos = i + 1
    break
else:
  print("Impossible")
  exit()

print("Possible")
for i in range(1,pos):
  print(i)
for i in range(len(c) -1, pos, -1):
  print(i)
print(pos)

Solution (Python):
n,l = map(int, input().split())
a = list(map(int, input().split()))
ans = "Impossible"
last = 0

for i in range(n-1):
    A = a[i]+a[i+1]
    if A>=l:
        ans= "Possible"
        last = i+1
        break

if ans=="Impossible":
    print(ans)
else:
    print(ans)

    if last!=1:
        for i in range(last-1):
            print(i+1)

    if last!=n-1:
        for i in reversed(range(last+1,n)):
            print(i)

    print(last)

Solution (Python):
n,l = map(int,input().split())
a = [0]+list(map(int,input().split()))
ll = None
for i in range(1,n):
    if a[i]+a[i+1] >= l:
        ll = i
        break

if not ll:
    print('Impossible')
else:
    print('Possible')
    for i in range(1,ll):
        print(i)
    for i in range(n-1,ll,-1):
        print(i)
    print(ll)

Solution (Python):
N,L,*A=map(int,open(0).read().split())
for i,a,b in zip(range(1,N),A,A[1:]):
    if a+b>=L:print("Possible",*range(1,i));print(*range(N-1,i-1,-1));quit()
print("Impossible")

Solution (Python):
def resolve():
    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:
            print("Possible")
            for j in range(i):
                print(j + 1)
            for j in range(n - 1, i, -1):
                print(j)
            return 0
    print("Impossible")


if __name__ == "__main__":
    resolve()

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






judge = 0
p1,p2 = -1,-1 
for i in range(N):
  if(i != N-1):
    if(A[i]+A[i+1] >= L):
      judge = 1
      p1,p2 = i,i+1
      break
point = p1+1 

if(judge == 0): print('Impossible')
else:
 print('Possible')
 for i in range(1,N):
  if(i == point): break
  else: print(i)
 for i in range(1,N):
  j = N-i
  if(j == point): break
  else: print(j) 
 print(point)

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

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

B = [A[i-1] + A[i] for i in range(1,N)]

if max(B) < L :
    print("Impossible")
else :
    print("Possible")

    ind = B.index(max(B))
    for i in range(ind) :
        print(i+1)
    for i in range(N-1,ind,-1) :
        print(i)

Solution (Python):
import sys
import os

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:
        print("Possible")
        for j in range(i):
            print(j+1)
        for j in range(N-1,i,-1):
            print(j)
        sys.exit()
print("Impossible")

Solution (Python):

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

flag = False
for i in range(n-1):
    if a[i] + a[i+1] >= l:
        flag = True
        pos = i
if flag:
    print('Possible')
    for i in range(n-1):
        if i < pos:
            print(i+1)
        elif i == pos :
            break
    for i in range(n-2, -1, -1):
        if i > pos :
            print(i+1)
        elif i == pos :
            break
    print(pos+1)
else:
    print('Impossible')

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

sum = [0]*(N - 1)
for i in range(N-1):
    sum[i] = a[i] + a[i+1]

if max(sum) < L:
    print("Impossible")
else:
    print("Possible")
    id = sum.index(max(sum))
    for i in range(id):
        print(i+1)
    for i in reversed(range(id+1, N-1)):
        print(i+1)
    print(id+1)

Solution (Python):



def main():
    n, l = map(int, input().split())
    a = list(map(int, input().split()))

    
    
    
    
    
    pos = -1

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

    if pos == -1:
        print("Impossible")
    else:
        print("Possible")

        
        pos += 1

        
        
        ans = [i for i in range(1, pos)] + [i for i in range(n - 1, pos, -1)] + [pos]
        print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()

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


for n in range(N - 1):
    if A[n] + A[n + 1] >= L:
        print('Possible')
        tmp_ind = n + 1
        for m in range(1, tmp_ind):
            print(m)
        for m in range(N - 1, tmp_ind, -1):
            print(m)
        print(tmp_ind)
        sys.exit()
print('Impossible')

Solution (Python):


N,L=map(int,input().split())
l=list(map(int,input().split()))
judge="Impossible"
index=0

for i in range(N-1):
    if (l[i]+l[i+1])>=L:
        judge="Possible"
        index=i
        break

print(judge)
if judge=="Impossible":
    exit()

for i in range(0,index):
    print(i+1)

for i in range(index+2,N)[::-1]:
    print(i)

print(index+1)

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, L = MAP()
A = LIST()


B = []
for i in range(1, N):
    B.append(A[i-1]+A[i])
mx = max(B)

if mx < L:
    print('Impossible')
    exit()


print('Possible')
idx = B.index(mx)
for i in range(idx):
    print(i+1)
for i in range(N-2, idx, -1):
    print(i+1)
print(idx+1)

Solution (Python):

def main():
    N, L, *A = map(int, open(0).read().split())
    B = [i + j for i, j in zip(A, A[1:])]
    x = max(B)
    if x < L:  
        print("Impossible")
        return
    idx = B.index(x) + 1
    
    ans = [i for i in range(1, idx)] + [i for i in range(N - 1, idx, -1)] + [idx]
    print("Possible")
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, L, *A = map(int, open(0).read().split())
    B = [i + j for i, j in zip(A, A[1:])]
    x = max(B)
    if x < L:  
        print("Impossible")
        return
    idx = B.index(x) + 1
    
    ans = [i for i in range(1, idx)] + [i for i in range(N - 1, idx, -1)] + [idx]
    print("Possible")
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()