import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n,s = na() a = na() b = [] c = 0 for i in range(n): if a[i]!=2: b.append(a[i]) else: c += 1 a = b n = len(b) kai = [1] for i in range(8): kai.append(kai[-1]*(i+1)) def binom(r,x): return kai[r]//kai[x]//kai[r-x] import functools @functools.lru_cache(maxsize=None) def saiki(s, c): r = 0 if c == 0 and s >= 0: return 1 if s < c: return 0 if s == c: return 1 for i in range(c+1): r += binom(c,i)*saiki((s-i)//2, c-i) return r from collections import defaultdict d = defaultdict(int) d[0] = 1 for i in range(n): od = defaultdict(int) d,od = od,d for j in od: x = a[i] while j + x <= s: d[j + x]+=od[j] x *= a[i] #print(d) #print(len(d)) ans = 0 for i in d: ans += d[i] * saiki((s-i)//2,c) print(ans)