#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll INF = 1e18;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    map<ll, ll> m;
    m[x] = 1;
    for(int i = n-1; i >= 0; i--)
    {
        map<ll, ll> tmp;
        ll t;
        if(i == n-1) t = INF;
        else t = a[i+1] / a[i];
        // (-t, t)
        for(auto p : m)
        {
            ll k = p.first;
            ll v = p.second;
            ll num = k % a[i];
            if(abs(k) / a[i] < t) tmp[num] += v;
            //cout << a[i] << " " << k << " " << v << " " << num << endl;
            if(abs(k) / a[i] < t-1 && num != 0)
            {
                if(num < 0) tmp[num+a[i]] += v;
                else tmp[num - a[i]] += v;
            }
        }
        swap(m, tmp);
    }
    ll ans = 0;
    for(auto i : m) ans += i.second;
    cout << ans << endl;
}

#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<fixed<<setprecision(15)<<head;print0(tail...);}
void print() { print0("\n"); }
template<typename Head,typename... Tail>void print(Head head,Tail... tail){print0(head);if(sizeof...(Tail)>0)print0(" ");print(tail...);}
// clang-format on

using pll = pair<ll, ll>;
ll N,X;
vector<ll>A;
vector<map<ll, ll>> memo(52);
ll recur(ll rest, ll i) {
  if(rest==0){
    return 1;
  }
  if(memo[i].count(rest)){
    return memo[i][rest];
  }
  if(rest>0 && rest%A[i]==0){
      memo[i][rest] = 1;
  }
  if(rest>0 && rest%A[i]!=0){
      ll ansrec = 0;
      ll nrest1 = rest/A[i];
      if (i==N-1 || nrest1 < A[i+1] / A[i]) {
          ansrec += recur(rest - A[i]*nrest1, i-1);   
      }
      ll nrest2 = 1+rest/A[i];
      if (i==N-1 || nrest2 < A[i+1] / A[i]) {
          ansrec += recur(rest - A[i]*nrest2, i-1);   
      }
      memo[i][rest] = ansrec;
  }
  ll rrest = -rest;
  if(rrest>0 && rrest%A[i]==0){
      memo[i][rest] = 1;
  }
  if(rest<0 && rrest%A[i]!=0){
      ll ansrec = 0;
      ll nrest1 = rrest / A[i];
      if (i==N-1 || nrest1 < A[i+1] / A[i]) {
          ansrec += recur(rest + A[i]*nrest1, i-1);   
      }
      ll nrest2 = 1 + rrest / A[i];
      if (i==N-1 || nrest2 < A[i+1] / A[i]) {
          ansrec += recur(rest + A[i]*nrest2, i-1);   
      }
      memo[i][rest] = ansrec;
  }
  return memo[i][rest];
}
int main() {
    cin >> N>>X;
    A.resize(N);
    for (ll i = 0; i < N; i++) {
        cin>>A[i];
    }
    print(recur(X,N-1));

}
