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