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

//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define pb push_back
#define fi first
#define se second
#define ll long long
#define tp top()
#define fr front()
#define vi vector<int>
#define sz size()
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define mem(a,  b) memset(a,  (b),  sizeof(a))
#define clr(a) memset(a,  0,  sizeof(a))
#define sqr(x) ( (x) * (x) )
#define all(v) v.begin(),  v.end()

typedef pair<int, int> pii;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;



void base(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

ll a[55];
int n;

map<pair<int,ll>, ll> memo;

ll rek(int x, ll j){
	if (memo.find({x,j}) != memo.end()) return memo[{x,j}];
	ll cnt = 0;
	if (j % a[x]==0){		
		cnt = 1;
	} else {			
		ll y = j / a[x];		
		if (x == n-1 || y * a[x] < a[x+1]) cnt += rek(x-1, abs(y * a[x] - j));
		if (x == n-1 || (y+1) * a[x] < a[x+1]) cnt += rek(x-1, abs((y+1) * a[x] - j));
	}	
	return memo[{x,j}] = cnt;
}

void solve(){	
	ll x; cin>>n>>x;	
	rep(i,0,n) cin>>a[i];
	cout<<rek(n-1,x)<<"\n";
}

int main()
{
	base();
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}





#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<bool> vbl;
typedef vector<vector<bool>> vvbl;

void INX(){}
template<typename Head, typename... Tail>
void INX(Head&& head, Tail&&... tail)
{
    cin >> head;
    INX(forward<Tail>(tail)...);
}
void OUTX(){}
template<typename Head, typename... Tail>
void OUTX(Head&& head, Tail&&... tail)
{
    cout << head << endl;
    OUTX(forward<Tail>(tail)...);
}
void OUTX2(){cout << endl;}
template<typename Head, typename... Tail>
void OUTX2(Head&& head, Tail&&... tail)
{
    cout << head << ' ';
    OUTX2(forward<Tail>(tail)...);
}

#define ADD emplace_back
#define MP make_pair
#define __LONG_LONG_MIN__ (-__LONG_LONG_MAX__ - 1)

//#define MOD 1000000007 // 10^9 + 7
//setprecision(10)

// 公式解説

ll N;
vll ballcnt; // 色ごとのボールの数
vll lpos; // 色ごとにボールの左端(最小)の位置を記録した配列
vll rpos; // 色ごとにボールの右端(最大)の位置を記録した配列

vvpll dp; // 色cまで回収した時点でのコスト(.first)と位置(.second)
pll f(ll c, ll lr)
{
    if(c < 0) return MP(0, 0);
    else if(dp[c][lr].first >= 0) return dp[c][lr];
    else if(ballcnt[c] == 0) return f(c - 1, lr);
    else
    {
        auto f2 = [](pll &pre, ll &pass, ll &goal)
        {
            return MP(pre.first + abs(pass - pre.second) + abs(goal - pass), goal);
        };
        pll prel = f(c - 1, 0);
        pll prer = f(c - 1, 1);
        pll can1, can2;
        if(lr == 0)
        {
            can1 = f2(prel, rpos[c], lpos[c]);
            can2 = f2(prer, rpos[c], lpos[c]);
        }
        else
        {
            can1 = f2(prel, lpos[c], rpos[c]);
            can2 = f2(prer, lpos[c], rpos[c]);
        }
        pll &result = (can1.first < can2.first ? can1 : can2);
        dp[c][lr] = result;
        return result;
    }
}

int main()
{
    INX(N);
    ballcnt.resize(N, 0);
    lpos.resize(N, __LONG_LONG_MAX__);
    rpos.resize(N, __LONG_LONG_MIN__);
    dp.resize(N, vpll(2, MP(-1, -1)));

    for (ll i = 0; i < N; i++)
    {
        ll X, C;
        INX(X, C);
        C--;
        lpos[C] = min(lpos[C], X);
        rpos[C] = max(rpos[C], X);
        ballcnt[C]++;
    }

    pll can1 = f(N - 1, 0);
    pll can2 = f(N - 1, 1);
    ll can1c = can1.first + abs(can1.second);
    ll can2c = can2.first + abs(can2.second);
    OUTX(min(can1c, can2c));


    return 0;
}
