#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T1, class T2>
ostream& operator<<(ostream& s, pair<T1, T2> P) {
  return s << '<' << P.first << ", " << P.second << '>';
}
template <class T>
ostream& operator<<(ostream& s, vector<T> P) {
  for (int i = 0; i < P.size(); ++i) {
    if (i > 0) {
      s << " ";
    }
    s << P[i];
  }
  return s;
}
template <class T>
ostream& operator<<(ostream& s, vector<vector<T> > P) {
  for (int i = 0; i < P.size(); ++i) {
    s << endl << P[i];
  }
  return s << endl;
}
template <class T>
ostream& operator<<(ostream& s, set<T> P) {
  for (auto it : P) {
    s << "<" << it << "> ";
  }
  return s << endl;
}
template <class T1, class T2>
ostream& operator<<(ostream& s, map<T1, T2> P) {
  for (auto it : P) {
    s << "<" << it.first << "->" << it.second << "> ";
  }
  return s << endl;
}
int N;
long long K;
vector<long long> A;
using pll = pair<long long, int>;
long long solve() {
  long long asum = 0;
  for (int i = 0; i < N; ++i) asum += A[i];
  long long LIM = 2100000000000000000LL;
  vector<pll> v;
  v.emplace_back(100, -1);
  for (int i = 0; i < N; ++i)
    if (A[i] > 1) v.emplace_back(A[i], i);
  v.emplace_back(100, N);
  long long res = 0;
  if (K == 1) res = N - ((int)v.size() - 2);
  for (int i = 1; i + 1 < v.size(); ++i) {
    long long mul = 1;
    long long sum = 0;
    for (int j = i + 1; j < v.size(); ++j) {
      if (mul > LIM / v[j - 1].first) break;
      mul *= v[j - 1].first;
      sum += v[j - 1].first;
      if (mul % K != 0) continue;
      long long rsum = mul / K;
      long long insidesum = v[j - 1].second - v[i].second - (j - 1 - i);
      long long need = rsum - sum - insidesum;
      if (need < 0) continue;
      long long left = v[i].second - v[i - 1].second - 1;
      long long right = v[j].second - v[j - 1].second - 1;
      if (left + right < need) continue;
      long long mi = max(0LL, need - right);
      long long ma = min(left, need);
      long long add = ma - mi + 1;
      res += add;
    }
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  while (cin >> N >> K) {
    A.resize(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    cout << solve() << endl;
  }
}
