import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.NoSuchElementException; import java.util.Scanner; public class Main { static FastScanner scan = new FastScanner(); static PrintWriter out = new PrintWriter(System.out); static int n; static long s; static long[] list; public static void main(String[] args) { n = scan.nextInt(); s = scan.nextLong(); list = new long[n]; for(int i=0; i indexList = new ArrayList(); ArrayList left = new ArrayList(); ArrayList right = new ArrayList(); ArrayList outList = new ArrayList(); solve(0, n/2, 0, left, indexList); solve(n/2, n, 0, right, indexList); Collections.sort(right); for(int i=0; i s) { r = m; } else if(v < s) { l = m+1; } } } Collections.sort(outList, new UserComparator()); for(String str : outList) { out.println(str); } out.flush(); } static void solve(int i, int n, long sum, ArrayList nowList, ArrayList indexList) { if(i == n) { nowList.add(new Node(sum, (ArrayList)indexList.clone())); return; } solve(i+1, n, sum, nowList, indexList); indexList.add(i); solve(i+1, n, sum + list[i], nowList, indexList); indexList.remove(Integer.valueOf(i)); } static class Node implements Comparable{ long v; ArrayList indexes; Node(long v, ArrayList indexes) { this.v = v; this.indexes = indexes; } @Override public int compareTo(Node o) { return (int)(v - o.v); } public Node add(Node o) { ArrayList ret = new ArrayList(); ret.addAll(indexes); ret.addAll(o.indexes); return new Node(v, ret); } @Override public String toString() { StringBuffer sb = new StringBuffer(); for(int i=0; i0) sb.append(" "); sb.append(indexes.get(i)+1); } return sb.toString(); } } final static class UserComparator implements Comparator { public int compare(Object o1, Object o2) { String values1[] = ((String)o1).split(" "); String values2[] = ((String)o2).split(" "); int i=0; while(true) { long v1 = Long.parseLong(values1[i]); long v2 = Long.parseLong(values2[i]); if(v1 == v2) { i++; continue; } return (int)(v1 - v2); } } } } class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { return (int)nextLong(); } }