/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { static int n; static int target; static int SUM; static HashMap remMap = new HashMap(); public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] lines = br.readLine().split(" "); n = Integer.parseInt(lines[0]); target = Integer.parseInt(lines[1]); ArrayList prices = new ArrayList(); for(int i=0;i(),0,0); for(String a:ans){ System.out.println(a); } } static ArrayList ans = new ArrayList(); public static int check(ArrayList prices,ArrayList items,int sum,int idx){ if(sum == target){ ans.add(toString(items)); return 1; } if(ans.size()>50 || idx >= n || target>SUM-remMap.get(idx)+sum){ //System.out.println(SUM + " " + remMap.get(idx) + " " + sum); return 0; } int price = prices.get(idx); ArrayList cp_items = new ArrayList(items); cp_items.add(idx+1); int s = 0; s += check(prices,cp_items,sum+price,idx+1); s += check(prices,new ArrayList(items),sum,idx+1); return s; } public static String toString(ArrayList items){ StringBuilder sb = new StringBuilder(); for(int i:items){ if(sb.length() > 0){ sb.append(" "); } sb.append(i); } return sb.toString(); } }