from itertools import product N, W = map(int, input().split()) A = list(map(int, input().split())) used = set() for xs in product([0, 1, 2], repeat=N): tot = 0 b = 0 for i, x in enumerate(xs): match x: case 1: tot += A[i] case 2: tot += A[i] // 2 b = (b << 1) | int(bool(x)) if tot == W and b > 0: used.add(b) ans = len(used) print(ans)