import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int n1 = n / 2; int n2 = n - n1; int s = sc.nextInt(); int[] p1 = new int[n1]; int[] p2 = new int[n2]; for (int i = 0; i < n1; i++) { p1[i] = sc.nextInt(); } for (int i = 0; i < n2; i++) { p2[i] = sc.nextInt(); } TreeMap>> fir = new TreeMap(); TreeMap>> sec = new TreeMap(); int max1 = (int) Math.pow(2, p1.length); int max2 = (int) Math.pow(2, p2.length); for (int i = 1; i < max1; i++) { char[] bit = Integer.toBinaryString(i).toCharArray(); int sum = 0; TreeMap tmpSet = new TreeMap(); for (int j = 0; j < bit.length; j++) { if (bit[j] == '1') { sum = sum + p1[bit.length - 1 - j]; tmpSet.put(bit.length - j, p1[bit.length - 1 - j]); } } ArrayList> tmpList; if (fir.containsKey(sum)) { tmpList = fir.get(sum); } else { tmpList = new ArrayList(); fir.put(sum, tmpList); } tmpList.add(tmpSet); } for (int i = 1; i < max2; i++) { char[] bit = Integer.toBinaryString(i).toCharArray(); int sum = 0; TreeMap tmpSet = new TreeMap(); for (int j = 0; j < bit.length; j++) { if (bit[j] == '1') { sum = sum + p2[bit.length - 1 - j]; tmpSet.put(bit.length - j + n1, p2[bit.length - 1 - j]); } } ArrayList> tmpList; if (sec.containsKey(sum)) { tmpList = sec.get(sum); } else { tmpList = new ArrayList(); sec.put(sum, tmpList); } tmpList.add(tmpSet); } ArrayList> merged = new ArrayList(); if (fir.containsKey(s)) { ArrayList> set1 = fir.get(s); for (int i = 0; i < set1.size(); i++) { merged.add(set1.get(i)); } } for (int key : fir.keySet()) { if (!sec.containsKey(s - key)) { continue; } ArrayList> set1 = fir.get(key); ArrayList> set2 = sec.get(s - key); for (int i = 0; i < set1.size(); i++) { TreeMap merge = new TreeMap(); merger(merge, set1.get(i)); for (int j = 0; j < set2.size(); j++) { TreeMap tmp = (TreeMap)merge.clone(); merger(tmp, set2.get(j)); merged.add(tmp); } } } if (sec.containsKey(s)) { ArrayList> set2 = sec.get(s); for (int i = 0; i < set2.size(); i++) { merged.add(set2.get(i)); } } for (TreeMap tmpSet : merged) { boolean first = true; for (int num : tmpSet.keySet()) { if (first) { System.out.print(num); first = false; } else { System.out.print(" " + num); } } System.out.println(); } } private static void merger( TreeMap merge, TreeMap source) { for (int key : source.keySet()) { merge.put(key, source.get(key)); } } }