import bisect # Input N, S = map(int, input().split()) A = [ int(input()) for i in range(N) ] A.reverse() # Enumerate all sep = N // 2 cost1 = [ 0 ] * (1 << sep) for i in range(0, sep): for j in range(0, 1 << i): cost1[j | (1 << i)] = cost1[j] + A[i] cost2 = [ 0 ] * (1 << (N - sep)) for i in range(0, N - sep): for j in range(0, 1 << i): cost2[j | (1 << i)] = cost2[j] + A[i + sep] # Meet-in-the-middle scost1 = sorted([ (cost1[i], i) for i in range(0, 1 << sep) ]) for i in range((1 << (N - sep)) - 1, -1, -1): l = bisect.bisect_left(scost1, (S - cost2[i], -1)) r = bisect.bisect_left(scost1, (S - cost2[i] + 1, -1)) for j in range(r - 1, l - 1, -1): vals = list(filter(lambda x: ((i >> (N - sep - x)) & 1) == 1, range(1, N - sep + 1))) + list(filter(lambda x: ((scost1[j][1] >> (N - x)) & 1) == 1, range(N - sep + 1, N + 1))) print(*vals)