#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 

#define ff              first
#define ss              second
#define ll              int64_t
#define ld              long double
#define nl              cout<<"\n"
#define all(v)          v.begin(),v.end()
#define mset(a,v)       memset((a),(v),sizeof(a))
#define forn(i,a,b)     for(int64_t i=int64_t(a);i<int64_t(b);++i)
#define forb(i,a,b)     for(int64_t i=int64_t(a);i>=int64_t(b);--i)
#define fastio()        ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> 

#define mod         1000000007
#define mod2        998244353 
#define inf         1000000000000007
#define pi          3.14159265358979323846

template<class L,class R> ostream& operator<<(ostream& out,pair<L,R> &p)        {return out<<"("<<p.ff<<", "<<p.ss<<")";}
template<class T> ostream& operator<<(ostream& out,vector<T> &v)                {out<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())out<<", ";out<<*it;}return out<<"]";}
template<class T> ostream& operator<<(ostream& out,deque<T> &v)                 {out<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())out<<", ";out<<*it;}return out<<"]";}
template<class T> ostream& operator<<(ostream& out,set<T> &s)                   {out<<"{";for(auto it=s.begin();it!=s.end();++it){if(it!=s.begin())out<<", ";out<<*it;}return out<<"}";}
template<class L,class R> ostream& operator<<(ostream& out,map<L,R> &m)         {out<<"{";for(auto it=m.begin();it!=m.end();++it){if(it!=m.begin())out<<", ";out<<*it;}return out<<"}";}

void dbg_out() {cerr<<"]\n";}
template<typename Head,typename... Tail> 
void dbg_out(Head H,Tail... T) {cerr<<H;if(sizeof...(Tail))cerr<<", ";dbg_out(T...);}
#ifdef LOCAL
	#define dbg(...) cerr<<"["<<#__VA_ARGS__<<"] = [",dbg_out(__VA_ARGS__)
#else
	#define dbg(...)
#endif

ll count_digits(ll n)     {ll dig=floor(log10(n)+1);return dig;}
ll mpow(ll x,ll y,ll p)   {ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}
ll mod_inv(ll a,ll m)     {ll m0=m,y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}
/* const ll MAXN=1000007;ll spf[MAXN+5];vector<ll> prime; */
/* void sieve(ll n)        {forn(i,2,MAXN+1)spf[i]=i;for(ll i=2;i*i<=n;i++)if(spf[i]==i)for(ll j=i*i;j<=n;j+=i)if(spf[j]==j)spf[j]=i;forn(i,2,MAXN+1)if(spf[i]==i)prime.push_back(i);} */

//-------------------------------L_I_Erq34-------------------------------

vector<vector<ll>> dp;
vector<ll> cnt,max1;

ll calc(ll i,bool carry)
{
	if(i==cnt.size()-1)
		return 1;
	if(dp[i][carry]!=-1)
		return dp[i][carry];
	ll r=cnt[i]+carry;
	if(r==max1[i])
		return dp[i][carry]=calc(i+1,true);
	else if(!r)
		return dp[i][carry]=calc(i+1,false);
	return dp[i][carry]=calc(i+1,true)+calc(i+1,false);
}

int main()
{
	fastio();
	ll z,n,m,t,k,i,j,l,d,h,r;
	cin>>n>>k;
	vector<ll> a(n);
	for(ll &i:a)
		cin>>i;
	cnt=max1=vector<ll>(n);
	dp=vector<vector<ll>>(n,vector<ll>(2,-1));
	r=k;
	forb(i,n-1,0)
	{
		cnt[i]=r/a[i];
		r-=a[i]*cnt[i];
		if(i<n-1)
			max1[i]=a[i+1]/a[i];
	}
	cout<<calc(0,false)<<"\n";
	cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms\n";
	return 0;
}

#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define REP2(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = (l), i##_len = (int)(r); i < i##_len; ++i)
#define GET_MACRO_REP(_1, _2, _3, NAME, ...) NAME
#define REP(...) GET_MACRO_REP(__VA_ARGS__, REP3, REP2) (__VA_ARGS__)
#define RREP2(i, n) for (int i = (n - 1); i >= 0; --i)
#define RREP3(i, l, r) for (int i = (r - 1), i##_len = (l); i >= i##_len; --i)
#define GET_MACRO_RREP(_1, _2, _3, NAME, ...) NAME
#define RREP(...) GET_MACRO_REP(__VA_ARGS__, RREP3, RREP2) (__VA_ARGS__)
#define IN(type, n) type n; cin >> n
#define INALL(type, v) REP(i, v.size()) { IN(type, _tmp); v.at(i) = _tmp; }
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#ifdef _DEBUG
#define DEBUG(x) cout << #x << ": " << x << endl
#else
#define DEBUG(x)
#endif

template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
#pragma endregion

int main() {
  IN(int, N);
  IN(ll, X);
  vector<ll> A(N);
  vector<ll> max_use(N);
  REP(i, N) {
    IN(ll, a);
    A.at(i) = a;
    if (i > 0) max_use.at(i - 1) = a / A.at(i - 1);
  }

  if (X == A.at(N - 1)) {
    cout << "1" << endl;
    return 0;
  }
  vector<map<ll, ll> > dp(N);
  dp.at(N - 1)[X - (X / A.at(N - 1)) * A.at(N - 1)]++;
  dp.at(N - 1)[X - (X / A.at(N - 1) + 1) * A.at(N - 1)]++;
  RREP(i, N - 1) {
    for (auto itr = dp.at(i + 1).begin(); itr != dp.at(i + 1).end(); ++itr) {
      ll rem = itr->first;
      ll amount = rem / A.at(i);
      rem -= amount * A.at(i);
      if (abs(rem) < A.at(i)) 
        dp.at(i)[rem] += itr->second;
      if (abs(amount + 1) < max_use.at(i) && abs(rem - A.at(i)) < A.at(i)) 
        dp.at(i)[rem - A.at(i)] += itr->second;
      if (abs(amount - 1) < max_use.at(i) && abs(rem + A.at(i)) < A.at(i)) 
        dp.at(i)[rem + A.at(i)] += itr->second;
    }
  }

  cout << dp.at(0)[0] << endl;

  return 0;
}
