// 2020-12-27 15:59:19
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
// #include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
// #include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
// using namespace atcoder;

// clang-format on
void answer() {
  int n;
  ll x;
  cin >> n >> x;
  vector<ll> a(n), xs(n);
  rep(i, n) cin >> a[i];
  {
    ll w = x;
    rep(i, n - 1) {
      xs[i] = w % (a[i + 1] / a[i]);
      w /= (a[i + 1] / a[i]);
    }
    xs[n - 1] = w;
  }
  vector<vector<ll> > dp(n + 1, vector<ll>(2, 0));
  dp[0][0] = 1;
  rep(i, n - 1) {
    rep(j, 2) rep(k, 2) dp[i + 1][j] += dp[i][k];
    if (xs[i] == 0) dp[i + 1][1] -= dp[i][0];
    if (xs[i] == a[i + 1] / a[i] - 1) dp[i + 1][0] -= dp[i][1];
  }
  cout << dp[n - 1][0] + dp[n - 1][1] << '\n';
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}
//IQ134高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007
#define MODB  998244353 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}



int main() {
	ll ans = 0;
	ll tmp = 0;
	int n; cin >> n;
	vector<ll> a(n);
    cin >> a;
    map<ll, ll> m;
    m[0]++;
    REP(i, n){
        if(i%2==0)tmp += a[i];
        else tmp -= a[i];
        m[tmp]++;
    }
    for(auto it = m.begin(); it != m.end(); it++){
        ans += (it->second) * (it->second - 1LL) / 2;
    }
	cout << ans << endl;
}