from collections import defaultdict from itertools import product n,S = map(int,input().split()) A = list(map(int,input().split())) cntP = defaultdict(int) cntQ = defaultdict(int) if n >= 2: front = [] back = [] for a in A[:n//2]: front .append(a) for a in A[n//2:]: back.append(a) for Ks in product([i for i in range(1,33)],repeat = len(front)): P = 0 for l in range(len(front)): P += pow(front[l],Ks[l]) if P <= S: cntP[P] += 1 for Ks in product([i for i in range(1,33)],repeat=len(back)): Q = 0 for l in range(len(back)): Q += pow(back[l],Ks[l]) if Q <= S: cntQ[Q] += 1 ans = 0 for p in cntP.keys(): for q in cntQ.keys(): if p + q <= S: ans += cntP[p] * cntQ[q] print(ans) else: for k in range(1,33): if pow(A[0],k) <= S: pass else: break print(k-1)