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

using ull = unsigned long long;
using ll = long long;
using ld = long double;

const int mod = 1e9 + 7;
const double pi = acos(-1.0);
const int inf = INT_MAX;
const int N = 50 + 5;

int n;
ll x, a[N], lim[N], dp[N][2], num_x[N];

ll recurse(int i, int c) {
	if (dp[i][c] != -1) {
		return dp[i][c];
	}
	if (i == n - 1) {
		return 1;
	}
	if (c) {
		if (1 + num_x[i] == lim[i]) {
			dp[i][c] = recurse(i + 1, 1);
		} else {
			dp[i][c] = recurse(i + 1, 0) + recurse(i + 1, 1);
		}
	} else {
		if (num_x[i]) {
			dp[i][c] = recurse(i + 1, 0) + recurse(i + 1, 1);
		} else {
			dp[i][c] = recurse(i + 1, 0);
		}
	}
	return dp[i][c];
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	cin >> n >> x;
	for (int i = 0; i < n; i++) cin >> a[i];

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

	ll temp = x;
	for (int i = 0; i < n; i++) {
		num_x[i] = temp % lim[i];
		temp /= lim[i];
//		cout << num_x[i] << ' ';
	}
//	cout << '\n';

	memset(dp, -1, sizeof(dp));
	cout << recurse(0, 0) << '\n';
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	ll X; cin >> X;
	vector<ll> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	vector<ll> x(n);
	for(int i=n-1;i>=0;i--){
		x[i]=X/a[i];
		X%=a[i];
	}
	vector<ll> t(n);
	for(int i=0;i+1<n;i++){
		t[i]=a[i+1]/a[i];
	}
	t.back()=1e18;
	vector<ll> dp(2);
	dp[0]=1;
	for(int i=0;i<n;i++){
		vector<ll> pre(2);
		swap(dp,pre);
		for(int j=0;j<2;j++){
			for(int k=0;k<2;k++){
				{// Yが0
					ll z=t[i]*k-x[i]-j;
					if(0<=z and z<t[i]){
						dp[k]+=pre[j];
					}
				}
				{// お釣りが0
					ll y=x[i]+j-t[i]*k;
					if(0<y and y<t[i]){
						dp[k]+=pre[j];
					}
				}
			}
		}
	}
	cout << dp[0] << endl;
}