import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; public class Main { public static void dfs(final long S, final int N, final int deep, int[] items, int[] maximum, LinkedList stack){ if(S == 0){ // boolean first = true; for(final int item : stack){ if(first){ first = false; }else{ System.out.print(" "); } System.out.print(item + 1); } System.out.println(); return; }else if(deep >= N){ return; }else if(maximum[deep] < S){ return; } if(S >= items[deep]){ stack.addLast(deep); dfs(S - items[deep], N, deep + 1, items, maximum, stack); stack.removeLast(); } dfs(S, N, deep + 1, items, maximum, stack); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final long S = sc.nextLong(); int[] items = new int[N]; for(int i = 0; i < N; i++){ items[i] = sc.nextInt(); } int[] maximum = new int[N]; for(int i = N - 1; i >= 0; i--){ maximum[i] = items[i] + (i == N - 1 ? 0 : maximum[i + 1]); } dfs(S, N, 0, items, maximum, new LinkedList()); } }