N,W = map(int,input().split()) a = list(map(int,input().split())) ans = set() for bit in range(3**N): ret = 0 x = bit b = 0 for i in range(N): if x % 3 == 0: pass else: if x % 3 == 2: ret += a[i] // 2 elif x % 3 == 1: ret += a[i] b += 1 x //= 3 b <<= 1 if ret == W: ans.add(b) print(len(ans))