package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func out(x ...interface{}) { fmt.Println(x...) } var sc = bufio.NewScanner(os.Stdin) func getInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func getInts(N int) []int { ret := make([]int, N) for i := 0; i < N; i++ { ret[i] = getInt() } return ret } func getString() string { sc.Scan() return sc.Text() } // min, max, asub, absなど基本関数 func max(a, b int) int { if a > b { return a } return b } func min(a, b int) int { if a < b { return a } return b } func asub(a, b int) int { if a > b { return a - b } return b - a } func abs(a int) int { if a >= 0 { return a } return -a } func lowerBound(a []int, x int) int { idx := sort.Search(len(a), func(i int) bool { return a[i] >= x }) return idx } func upperBound(a []int, x int) int { idx := sort.Search(len(a), func(i int) bool { return a[i] > x }) return idx } const inf = 1001001001001001 var n, s int var p []int var acc []int var dp [32][]bool func rec(k, v int, r []int) bool { if dp[k][v] == true { return true } if k == n { if v == s { for _, x := range r { fmt.Print(x+1, " ") } out() return false } return true } if k > s { return true } ret0 := rec(k+1, v+p[k], append(r, k)) dp[k+1][v+p[k]] = ret0 ret1 := rec(k+1, v, r) dp[k+1][v] = ret1 return ret0 && ret1 } func main() { sc.Split(bufio.ScanWords) n, s = getInt(), getInt() p = getInts(n) acc = make([]int, n) for i := 0; i < 32; i++ { dp[i] = make([]bool, 310000000) } acc[n-1] = p[n-1] for i := n - 1; i > 0; i-- { acc[i-1] += acc[i] + p[i-1] } rec(0, 0, []int{}) }