#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll n, x;
ll a[55], X[55], dp[55][2];

// X + t = y
ll solve(int pos, int carry){
    if(pos == n-1) return 1;
    if(dp[pos][carry] != -1) return dp[pos][carry];
    ll res = 0;
    ll have = X[pos] + carry;
    ll need = a[pos+1]/a[pos];
    if(have == need) res = solve(pos+1, 1);
    else if(have == 0) res = solve(pos+1, 0);
    else{
        // two options:
        // dont use this coin, or use it enought times so that we will have to carry
        res = solve(pos+1, 0) + solve(pos+1, 1);
    }
    return dp[pos][carry] = res;
}

int main(){
    cout.sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> n >> x;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    a[n] = a[n-1]*3;
    for(int i = n-1; i >= 0; i--){
        X[i] = x/a[i];
        x %= a[i];
    }
    cout << solve(0, 0) << endl;
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    ll X;
    cin >> N >> X;
    vector<ll> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    vector<ll> mag(N-1);
    for(int i=0; i<N-1; i++) {
        mag[i] = A[i+1] / A[i];
    }

    vector<ll> xm(N, 0);
    {
        ll cp = X;
        for(int i=N-1; i>=0; i--) {
            xm[i] = cp / A[i];
            cp %= A[i];
        }
    }
    // for(auto num : xm) cout << num << ' ';

    map<ll, int> mp;
    mp[X]++;
    auto dfs = [&] (auto &&dfs, int idx, const vector<ll> &m, ll num)->ll {
        ll count = 0;
        for(int i=idx; i<N-1; i++) {
            if(m[i] > 0) {
                ll nxt = num + (mag[i] - m[i]) * A[i];
                vector<ll> tmp = m;
                tmp[i] = 0;
                for(int j=i+1; j<N; j++) {
                    tmp[j]++;
                    if(j < N - 1 && tmp[j] == mag[j]) tmp[j] = 0;
                    else break;
                }
                // for(auto n : tmp) cout << n << ' ';
                // cout << '\n';
                vector<ll> rem = tmp;
                for(int j=N-1; j>=0; j--) {
                    rem[j] -= xm[j];
                    if(rem[j] > 0 && j != 0) {
                        rem[j]--;
                        rem[j-1] += mag[j-1];
                    }
                }
                for(int j=0; j<N-1; j++) {
                    if(rem[j] == mag[j]) {
                        rem[j] = 0;
                        rem[j+1]++;
                    }
                }
                // for(auto n : rem) cout << n << ' ';
                // cout << '\n';
                // cout << nxt << '\n';
                bool ok = true;
                for(int j=0; j<N; j++) {
                    if(tmp[j] > 0 && rem[j] > 0) ok = false;
                }
                if(ok && mp[nxt] == 0) {
                    ll cpnxt = nxt;
                    for(int j=0; j<idx; j++) cpnxt -= m[j] * A[j];
                    if(mp[cpnxt] > 0) mp[nxt] = mp[cpnxt];
                    else mp[nxt] = dfs(dfs, i+1, tmp, nxt);
                    count++;
                    count += mp[nxt];
                }
            }
        }
        return count;
    };

    cout << 1 + dfs(dfs, 0, xm, X) << endl;
    return 0;
}
