from bisect import bisect_left def acum(List):#累積和 rev = [0 for _ in range(len(List))] for i in range(len(List)): if i == 0: rev[i] = List[i] else: rev[i] = rev[i-1] + List[i] return rev 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 qlist = set() 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 qlist.add(Q) qlist = sorted(list(qlist)) value = [] for q in qlist: value.append(cntQ[q]) cum = acum(value) ans = 0 for p in cntP.keys(): index = bisect_left(qlist,S-p+1) -1 if index == -1: continue ans += cntP[p] * cum[index] print(ans) else: for k in range(1,33): if pow(A[0],k) <= S: pass else: break print(k-1)