from bisect import * def f(L): if L == []: return 0 n = len(L) temp = [] if n == 1: for a in range(1, 31): v1 = L[0] ** a if v1 > S: break temp.append(v1) elif n == 2: for a in range(1, 31): v1 = L[0] ** a if v1 > S: break for b in range(1, 31): v2 = v1 + L[1] ** b if v2 > S: break temp.append(v2) elif n == 3: for a in range(1, 31): v1 = L[0] ** a if v1 > S: break for b in range(1, 31): v2 = v1 + L[1] ** b if v2 > S: break for c in range(1, 31): v3 = v2 + L[2] ** c if v3 > S: break temp.append(v3) else: for a in range(1, 31): v1 = L[0] ** a if v1 > S: break for b in range(1, 31): v2 = v1 + L[1] ** b if v2 > S: break for c in range(1, 31): v3 = v2 + L[2] ** c if v3 > S: break for d in range(1, 31): v4 = v3 + L[3] ** d if v4 > S: break temp.append(v4) return temp N, S = map(int, input().split()) A = list(map(int, input().split())) N1 = (N + 1)//2 L1, L2 = f(A[:N1]), f(A[N1:]) ans = 0 L2.sort() for a in L1: ans += bisect_right(L2, S - a) print(ans)