#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int N;
unsigned long long X;
unsigned long long A[50];
unsigned long long Amul[49];
long long base[50];

void A_to_Amul() {
    Amul[0] = A[0];
    for (int i = 0; i < N-1; i++) {
        Amul[i] = A[i+1] / A[i];
    }
}

void X_to_base(unsigned long long X) {
    for (int i = 0; i < N - 1; i++) {
        base[i] = X % Amul[i];
        X = (X - base[i]) / Amul[i];
    }
    base[N-1] = X;
}

void print_Amul() {
    for (int i = 0; i < N-1; i++) {
        cout << Amul[i] << " ";
    }
    cout << endl;
}

void print_base() {
    for (int i = 0; i < N; i++) {
        cout << base[i] << " ";
    }
    cout << endl;
}

unsigned long long ans[50];

int main() {
    cin >> N >> X;
    for (int i = 0; i < N; i++) cin >> A[i];
    
    A_to_Amul();
//    print_Amul();
    
    X_to_base(X);
//    print_base();
    
    vector<int> vld_fsts, vld_lsts;
    for (int i = 0; i < N-1; i++) {
        if (base[i] > 0) vld_lsts.push_back(i);
    }
    for (int i = 1; i < N-1; i++) {
        if (base[i] < Amul[i] - 1) vld_fsts.push_back(i);
    }
    vld_fsts.push_back(N-1);
        
//    cout << "fst = ";
//    for (int i = 0; i < vld_fsts.size(); i++) {
//        cout << vld_fsts[i] << " ";
//    }
//    cout << endl;
//    
//    cout << "lst = ";
//    for (int i = 0; i < vld_lsts.size(); i++) {
//        cout << vld_lsts[i] << " ";
//    }
//    cout << endl;

    ans[0] = 0;
    for (int f = 1; f < N; f++) {
        ans[f] = ans[f-1];
        auto it_fst = find(vld_fsts.begin(), vld_fsts.end(), f);
        if (it_fst == vld_fsts.end()) {
            continue;
        }
        for (int l = f-1; l >= 0; l--) {
            auto it_lst = find(vld_lsts.begin(), vld_lsts.end(), l);
            if (it_lst != vld_lsts.end()) {
                ans[f] += 1 + (l >= 1 ? ans[l-1] : 0);
            }
        }
    }
    
//    for (int i = 0; i < N; i++) {
//        cout << ans[i] << " ";
//    }
//    cout << endl;
    
    cout << ans[N-1] + 1;
    
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
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;
}
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define repl(i, a, b) for(int i = a; i < int(b); i++)
#define rep(i, n) repl(i, 0, n)
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    int N;
    ll X;
    cin >> N >> X;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];

    vector<map<ll, ll>> dp(60);
    dp[0][X] = 1;

    rep(i, N) {
        for(const auto &[j, val] : dp[i]) {
            if(i < N - 1) {
                ll r = j % a[i + 1];
                dp[i + 1][j - r] += val;
                if(r > 0) dp[i + 1][j + a[i + 1] - r] += val;
            } else {
                dp[i + 1][0] += val;
            }
        }
    }

    cout << dp[N][0] << "\n";
}