package main import ( "fmt" "bufio" "os" "strconv" ) type Cell struct { n int s string } func newCell(n int, s string) *Cell { cp := new(Cell) cp.n = n cp.s = s return cp } func main() { r := bufio.NewReader(os.Stdin) w := bufio.NewWriter(os.Stdout) defer w.Flush() var N, W int fmt.Fscan(r, &N, &W) a := make([]int, N) for i := 0; i < N; i++ { fmt.Fscan(r, &a[i]) } w0 := make([]*Cell, 1) w0[0] = newCell(0, "") for i := 0; i < N; i++ { w1 := make([]*Cell, 0) for _, wv := range w0 { w, v := wv.n, wv.s w1 = append(w1, newCell(w, v)) if w + a[i] / 2 <= W { w1 = append(w1, newCell(w + a[i] / 2, v + strconv.Itoa(i) + ",")) } if w + a[i] <= W { w1 = append(w1, newCell(w + a[i], v + strconv.Itoa(i) + ",")) } } w0 = w1 } if W == 0 { w0 = w0[1:] } m := make(map[string]bool) for _, xy := range w0 { if xy.n == W { m[xy.s] = true } } fmt.Fprintln(w, len(m)) }