#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void dout() { cerr << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << H << ' ';
  dout(T...);
}
vector<ll> a;
ll k;
ll solve(int l, int r) {
  if (r - l == 1) return k == 1 && a[l] != 0;
  int m = (l + r) / 2;
  ll ans = 0;
  ans += solve(l, m);
  ans += solve(m, r);
  map<ll, vector<ll>> b;
  ll prod = 1;
  ll sum = 0;
  for (int i = m; i < r; i++) {
    if ((double)prod * a[i] > 2e18 || a[i] == 0) break;
    prod *= a[i];
    sum += a[i];
    b[prod].push_back(sum);
  }
  prod = 1;
  sum = 0;
  for (int i = m - 1; i >= l; i--) {
    if ((double)prod * a[i] > 2e18 || a[i] == 0) break;
    prod *= a[i];
    sum += a[i];
    for (auto& [p2, v] : b) {
      if ((double)prod * p2 > 2e18) continue;
      ll pp = prod * p2;
      if (pp % k == 0 && binary_search(v.begin(), v.end(), pp / k - sum)) ans++;
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << solve(0, n);
  return 0;
}
