from itertools import product n, w = map(int, input().split()) a = list(map(int, input().split())) if w == 0: zero = a.count(0) ans = 2 ** zero - 1 print(ans) exit() b = [i // 2 for i in a] ans = 0 it = [] items = [i for i in range(n)] for bits in product([0, 1], repeat=n): tmp = [[x] for x, bit in zip(items, bits) if bit == 1] if tmp == []: continue it.append(tmp) for i in it: l = [] for j in range(len(i)): l.append([a[j], b[j]]) st = [] for k in product(*l): k = sorted(k) if sum(k) == w and k not in st: st.append(k) ans += 1 print(ans)