import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); Goods.size = n; int sum = sc.nextInt(); int[] ev = new int[n - n / 2]; int[] od = new int[n / 2]; for (int i = 0; i < n; i++) { if (i % 2 == 0) { ev[i / 2] = sc.nextInt(); } else { od[i / 2] = sc.nextInt(); } } TreeMap> evMap = getMap(ev); TreeMap> odMap = getMap(od); ArrayList ans = new ArrayList<>(); for (int x : evMap.keySet()) { if (x > sum) { break; } if (!odMap.containsKey(sum - x)) { continue; } for (int y : evMap.get(x)) { for (int z : odMap.get(sum - x)) { ans.add(getGoods(y, z)); } } } Collections.sort(ans); System.out.println(ans.stream().map(x -> x.toString()).collect(Collectors.joining("\n"))); } static Goods getGoods(int ev, int od) { Goods ans = new Goods(); for (int i = 0; ev > 0; i++) { if (ev % 2 == 1) { ans.buy(i * 2); } ev >>= 1; } for (int i = 0; od > 0; i++) { if (od % 2 == 1) { ans.buy(i * 2 + 1); } od >>= 1; } return ans; } static class Goods implements Comparable { static int size; boolean[] exists; public Goods() { exists = new boolean[size]; } public void buy(int x) { exists[x] = true; } public int compareTo(Goods another) { for (int i = 0; i < size; i++) { if (exists[i] != another.exists[i]) { if (exists[i]) { return -1; } else { return 1; } } } return 0; } public String toString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < size; i++) { if (exists[i]) { if (sb.length() != 0) { sb.append(" "); } sb.append(i + 1); } } return sb.toString(); } } static TreeMap> getMap(int[] arr) { TreeMap> map = new TreeMap<>(); map.put(0, new ArrayList<>()); map.get(0).add(0); for (int i = 0; i < arr.length; i++) { Integer key = Integer.MAX_VALUE; while ((key = map.lowerKey(key)) != null) { if (!map.containsKey(key + arr[i])) { map.put(key + arr[i], new ArrayList<>()); } for (int x : map.get(key)) { map.get(key + arr[i]).add(x + (1 << i)); } } } return map; } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }