n,S = map(int,input().split()) a = list(map(int,input().split())) from functools import lru_cache @lru_cache def calc(i,s): if i == n: return 1 ans = 0 k = 1 while a[i] ** k <= s: ans += calc(i + 1,s - a[i] ** k) k += 1 return ans print(calc(0,S))