#include #include #include using namespace std; int N,S; vectorA; vectorret; void dfs(int id,int now) { if(id==A.size())ret.push_back(now); else { long t=A[id]; while(now+t<=S) { dfs(id+1,now+t); t*=A[id]; } } } vector >f(vectorA_) { A=A_; dfs(0,0); vector >cnt; sort(ret.begin(),ret.end()); for(int i=0;i>N>>S; vectorAi(N); for(int i=0;i>Ai[i]; vector >L=f(vector(Ai.begin(),Ai.begin()+N/2)); vector >R=f(vector(Ai.begin()+N/2,Ai.end())); int r=0; long ans=0,sum=0; for(int l=L.size();l--;) { while(r