import std.stdio; import std.conv, std.array, std.algorithm, std.string; import std.math, std.random, std.range, std.datetime; import std.bigint; void main(){ int n, s; { int[] xs = readln.chomp.split.map!(to!int).array; n = xs[0], s = xs[1]; } int n2 = n / 2; long[] ps; foreach(i; 0 .. n) ps ~= readln.chomp.to!long; long[][long] ks1, ks2; { int i = n2 - 1; long m = 2 ^^ i; long v = 0; long k = 0; while(1){ if(v in ks1) ks1[v] ~= k; else ks1[v] = [k]; while(k & m){ k -= m; v -= ps[i]; i -= 1, m /= 2; } if(m > 0){ k += m; v += ps[i]; i = n2 - 1, m = 2 ^^ i; } else break; } } { int i = n - n2 - 1; long m = 2 ^^ i; long v = 0; long k = 0; while(1){ if(v in ks2) ks2[v] ~= k; else ks2[v] = [k]; while(k & m){ k -= m; v -= ps[i + n2]; i -= 1, m /= 2; } if(m > 0){ k += m; v += ps[i + n2]; i = n - n2 - 1, m = 2 ^^ i; } else break; } } long[] ks; for(long v = 0; v <= s; v ++){ if(v in ks1 && (s - v) in ks2){ foreach(k1; ks1[v]) foreach(k2; ks2[s - v]) ks ~= k1 + k2 * (2 ^^ n2); } } bool isLess(long a, long b){ if(a == b) return false; if((a & 1) && !(b & 1)) return true; if(!(a & 1) && (b & 1)) return false; else return isLess(a / 2, b / 2); } ks.sort!(isLess)(); string[] ans; foreach(k; ks){ int[] ix; int i = 0; long m = 1; while(m <= k){ if(k & m) ix ~= i; i += 1, m *= 2; } ans ~= ix.map!(x => x + 1).map!(to!string).array.join(" "); } foreach(a; ans) a.writeln; }