/*
“The only way that we can live is if we grow.
 The only way we can grow is if we change. 
The only way we can change is if we learn.
 The only way we can learn is if we are exposed.
 And the only way that we are exposed is if we throw ourselves into the open.”
 ***************************************   ************************   **********************************
*/
#include <bits/stdc++.h>
using namespace std;


//---------------------mishra ka idea------------------ 
#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define sz(x)	    (int)(x).size()
#define ull       unsigned long long
//------------------------mishra ka idea-------------------

//-------------------------alsi hu mai-----------------------
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
#define _init(b)     memset(b,-1,sizeof(b))
#define _init0(b)     memset(b,0,sizeof(b))
#define MOD         1000000007
#define hell        998244353
#define output(x) cout << (x ? "YES" : "NO")<<endl;
#define Output(x) cout << (x ? "Yes" : "No")<<endl;
//-------------------------alsi hu mai-----------------------



//--------------------het se uthaya---------------------
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18) 
 
 
 
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("in.txt");ofstream coutt("out.txt");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;} 

//--------------------het se uthaya-------------------------------------------------------------------


int gcd(int a, int b) {if(a>b)swap(a,b) ;  if (a == 0)  return b; return gcd(b % a, a); }  
int rint(int  l , int r){return rand()%(r-l+1) + l ;}
 
//---------------------------aab code dekho bahut template dekh liya---------------------------------
bool poss(int a , int b){
	return (a<b && a>-b);
}

 
signed main()
{
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int i,j,x,n,k;
   cin>>n>>k;
   map<int,int> mp;
   mp[k]=1;
   vi v;

   fo(i,0,n){
   	cin>>x;
   	v.pb(x);
   }
   v.pb(INF);
   reverse(all(v));
   int a , b , c;

   fo(i,1,n){
   		map<int,int>  np;
   		for(auto aa : mp){
   			// cout<<">>"<<aa.x<<","<<aa.y<<"<< ";
   				a = aa.x/v[i];
   				if(poss(aa.x-a*v[i],v[i]) && poss(a,v[i-1]/v[i]))np[aa.x-a*v[i]]+=aa.y;
   				if(poss(aa.x-(a+1)*v[i],v[i]) && poss(a+1,v[i-1]/v[i]) )np[aa.x-(a+1)*v[i]]+=aa.y;
   				if(poss(aa.x-(a-1)*v[i],v[i]) && poss(a-1,v[i-1]/v[i]))np[aa.x-(a-1)*v[i]]+=aa.y;
   			
   		}
   		//cout<<endl;
   		swap(np,mp);
   }
   int ans=0;
   for(auto aa : mp){
   		//cout<<">>"<<aa.x<<","<<aa.y<<"<< ";
   		ans+=aa.y;
   }
   cout<<ans<<endl;

   
   
   
   
    return 0;
}



// Problem: F - Valid payments
// Contest: AtCoder - AtCoder Beginner Contest 182
// URL: https://atcoder.jp/contests/abc182/tasks/abc182_f
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long int
#define ii int
#define du double
#define jmp "\n"
#define vl vector<ll>
#define vvl vector<vl>
#define pb push_back
#define printv(v)     \
  for (auto x : v)    \
    cout << x << " "; \
  cout << jmp;
#define vi vector<int>
#define vb vector<bool>
#define ump unordered_map
#define SORT(v) sort(v.begin(), v.end())
#define REV(x) reverse(x.begin(), x.end())
#define all(x) x.begin(), x.end()
#define SET(x, a) memset(x, a, sizeof(x))
#define si(x) (ll) x.size()
#define ff first
#define ss second
#define I(a)        \
  for (auto &x : a) \
    cin >> x;
#define iin insert
#define deb(x) cout << "test " << #x << "=" << x << jmp
#define deb2(x, y) cout << "test " << #x << "=" << x << "," << #y << "=" << y << jmp
using namespace std;
const ll nax = 1e5 + 5;
vl a;
ll n, k;
map<pair<ll, ll>, ll> dp;
ll r(ll x, ll i)
{
	
  if (i == n - 1)
    return (x % a[i] == 0);

  if (dp.count({i, x}))
    return dp[{i, x}];
  if (x % a[i + 1])
    return dp[{i, x}] = r(x - (x % a[i + 1]), i + 1) + r(x + a[i + 1] - (x % a[i + 1]), i + 1);
  else
    return dp[{i, x}] = r(x, i + 1);
}
void solve()
{
  // ll n, k;
  cin >> n >> k;
  a = vl(n);
  I(a);
  cout << r(k, 0);
}
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  // cin >> t;
  while (t--)
    solve();
  return 0;
}