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 0: b <<= 1 case 1: tot += A[i] b = (b << 1) | 1 case 2: tot += A[i] // 2 b = (b << 1) | 1 if tot == W: used.add(b) ans = len(used) print(ans)