#include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < n; i++) #define rrep(i,n) for (int i = n-1; i >= 0; i--) #define rep2(i,a,b) for (int i = a; i < b; i++) #define rrep2(i,a,b) for (int i = a-1; i >= b; i--) #define rep3(i,a,b,c) for (int i = a; i < b; i+=c) #define rrep3(i,a,b,c) for (int i = a-1; i >= b; i-=c) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} ll n,s,A[8]; vectordfs(int l,int r){ vectorv; ll a=A[l]; if(l+1==r){ while(a<=s){ v.push_back(a); a*=A[l]; } return v; } vectorw=dfs(l+1,r); while(a<=s){ for(auto x:w){ if(a+x<=s)v.push_back(a+x); } a*=A[l]; } return v; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin>>n>>s; rep(i,n)cin>>A[i]; vectorvf=dfs(0,n/2),vb=dfs(n/2,n); sort(all(vb)); ll ans=0; for(auto x:vf){ if(x==1)continue; ans+=upper_bound(all(vb),s-x)-vb.begin(); } cout<