//#include <atcoder/all>
//using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define bit(n) (1LL<<(n))
#define FIX(d) fixed << setprecision(d)
using P = pair<int, int>;
using LP = pair<ll, ll>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const ll LINF = (1LL<<60);

unsigned int xor128(){
  static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
  unsigned int t = (x^(x<<11));
  x=y; y=z; z=w; 
  return( w=(w^(w>>19))^(t^(t>>8)) );
}

int n;
int cx[200], cy[200], r[200];
int a[200], b[200], c[200], d[200];
//int ma[200], mb[200], mc[200], md[200];

ll score(){
  double sc = 0.0;
  REP(i,n){
    int area = (c[i]-a[i]) * (d[i]-b[i]);
    double tmp = 1.0 - (double)min(area,r[i]) / max(area,r[i]);
    sc += 1.0 - tmp*tmp;
  }
  sc *= 1e9;
  sc /= n;
  return (ll)round(sc);
}

void init(){
  REP(i,n){
    a[i] = cx[i];
    b[i] = cy[i];
    c[i] = cx[i]+1;
    d[i] = cy[i]+1;
  }
}

void add(int ind, int xy){
  int area = (c[ind]-a[ind]) * (d[ind]-b[ind]);
  bool minus = false, plus = false;
  if(xy&1){
    REP(i,n){
      if(i==ind) continue;
      if(max(a[i],a[ind]-1)<min(c[i],c[ind]) && max(b[i],b[ind])<min(d[i],d[ind])){
        minus = true;
      }
      if(max(a[i],a[ind])<min(c[i],c[ind]+1) && max(b[i],b[ind])<min(d[i],d[ind])){
        plus = true;
      }
    }
 

    if(abs(area-r[ind])>abs(area+d[ind]-b[ind]-r[ind])){
      if(c[ind]<10000 && !plus && (xy&2)) c[ind]++;
      else if(a[ind]>0 && !minus) a[ind]--;
    }
  }else{
    REP(i,n){
      if(i==ind) continue;
      if(max(a[i],a[ind])<min(c[i],c[ind]) && max(b[i],b[ind]-1)<min(d[i],d[ind])){
        minus = true;
      }
      if(max(a[i],a[ind])<min(c[i],c[ind]) && max(b[i],b[ind])<min(d[i],d[ind]+1)){
        plus = true;
       }
    }

    if(abs(area-r[ind])>abs(area+c[ind]-a[ind]-r[ind])){
      if(d[ind]<10000 && !plus && (xy&2)) d[ind]++;
      else if(b[ind]>0 && !minus) b[ind]--;
    }
  }
}

void les(int ind, int xy){
  if(xy&1){
    if(c[ind]-a[ind]==1) return;
    if(a[ind]==cx[ind]) c[ind]--;
    else if(c[ind]==cx[ind]+1) a[ind]++;
    else if(xy&2) a[ind]++;
    else c[ind]--;
  }else{
    if(d[ind]-b[ind]==1) return;
    if(b[ind]==cy[ind]) d[ind]--;
    else if(d[ind]==cy[ind]+1) b[ind]++;
    else if(xy&2) b[ind]++;
    else d[ind]--;
  }
}

const ll LIMIT = 490 * CLOCKS_PER_SEC / 100;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  REP(i,n) cin >> cx[i] >> cy[i] >> r[i];

  init();
  //ll mx = score();
  //cout << mx << endl;
  ll ti = clock();
  while(true){ 
    ll now = clock();
    ll sub = now - ti;
    if(sub > LIMIT) break;
    REP(loop, 300){
      //int ind = xor128() % n;
      //int xy = xor128() % 2;
      add(xor128()%n, (xor128()%4)+1);
      if((loop+1)%30==0) les(xor128()%n, (xor128()%4)+1);
    }
    //cout << mx << endl;
  }
  
  
  REP(i,n) cout << a[i] << " " << b[i] << " " << c[i] << " " << d[i] << '\n';
  return 0;
}

#include <bits/stdc++.h>

using namespace std;
#define len(a) (int) a.size()
#define long long long 

int nxt() {
    int a;
    scanf("%d", &a);
    return a;
}

const int N = 55;
long dp[N][2];
long a[N];
long k[N];
long s;
int can[N];
int n;

int main() {
    n = nxt();
    scanf("%lld", &s);

    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }

    for (int i = 0; i + 1 < n; ++i) {
        can[i] = a[i + 1] / a[i] - 1;
    }

    for (int i = n - 1; i >= 0; --i) {
        k[i] = s / a[i];
        s %= a[i];
    }

    dp[0][0] = 1;

    for (int i = 0; i + 1 < n; ++i) {
        for (int j = 0; j < 2; ++j) {
            if (dp[i][j] == 0) continue;
            long cur = k[i];
            if (j) {
                cur++;
            }
            if (cur == can[i] + 1) {
                dp[i + 1][1] += dp[i][j];
            } else {
                dp[i + 1][0] += dp[i][j];
                if (cur != 0) {
                    dp[i + 1][1] += dp[i][j];
                }
            }
        }
    }

    printf("%lld", dp[n - 1][0] + dp[n - 1][1]);

    return 0;
}