from bisect import * def dfs1(s, dep): if s>S: return if dep==n//2: l1.append(s) return for k in range(1, 31): dfs1(s+pow(a[dep], k), dep+1) def dfs2(s, dep): if s>S: return if dep==n: l2.append(s) return for k in range(1, 31): dfs2(s+pow(a[dep], k), dep+1) n, S = map(int, input().split()) a = list(map(int, input().split())) l1, l2 = [], [] dfs1(0, 0) dfs2(0, n//2) l2.sort() ans = 0 for v in l1: ans += bisect_right(l2, S-v) print(ans)