N, W = map(int, input().split()) A = tuple(map(int, input().split())) ans = 0 for b in range(1, 1 << N): # 別途c = 0のとき s = 0 for i in range(N): if (b >> i) & 1: s += A[i] if s == W: ans += 1 continue c = b while c: s = 0 for i in range(N): if (c >> i) & 1: s += A[i] // 2 elif (b >> i) & 1: s += A[i] if s == W: ans += 1 break c -= 1 c &= b print(ans)