def f(n, s, a) r = [] g = lambda{|i, sum, rr| i.upto(a.size-1).each{|ii| new_sum = sum - a[ii] if new_sum < 0 next elsif new_sum == 0 r << rr + [ii] else g.(ii + 1, new_sum, rr + [ii]) end } } g.(0, s, []) r end N, S = gets.split.map(&:to_i) P = N.times.map{gets.to_i} f(N, S, P).each{|r| puts r.map(&:succ)* " " }