import java.util.*; public class Main_yukicoder15 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long s = sc.nextLong(); long[] p = new long[n]; for (int i = 0; i < n; i++) { p[i] = sc.nextInt(); } int n1 = Math.min(n, 16); int n2 = n - n1; Map> hm = new HashMap<>(); for (int i = 0; i < 0x1 << n1; i++) { long tmp = 0; for (int j = 0; j < n1; j++) { if ((i & 0x1 << j) != 0) { tmp += p[j]; } } if (hm.containsKey(tmp)) { hm.get(tmp).add(i); } else { hm.put(tmp, new ArrayList(Arrays.asList(i))); } } List ret = new ArrayList<>(); for (int i = 0; i < 0x1 << n2; i++) { long tmp = 0; for (int j = 0; j < n2; j++) { if ((i & 0x1 << j) != 0) { tmp += p[j + n1]; } } if (hm.containsKey(s - tmp)) { for (int e : hm.get(s - tmp)) { ret.add(Integer.reverse(i << n1 | e) >>> 32 - n); } } } Collections.sort(ret); for (int i = ret.size() - 1; i >= 0; i--) { int e = ret.get(i); for (int j = n - 1; j >= 0; j--) { if ((e & 0x1 << j) != 0) { System.out.print(n - j); if (j > 0) { System.out.print(" "); } } } System.out.println(); } sc.close(); } }