#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e18 + 7;
const int inf = (int)1e9 + 7;
const double eps = 1e-7;
const double pi = 3.14159265359;
long long n, k, a[200000], last, ans;
vector<pair<long long, long long> > more1;
long long check_pos(int ind) {
  long long res = 0;
  long long cur_more1 = bool(a[ind] > 1), cur_ind = ind, x;
  long long cur_last = last, cur_s = a[ind], cur_p = a[ind], nxt_s;
  while (cur_more1 < 61 && cur_last < more1.size() - 1) {
    nxt_s = more1[cur_last].first - cur_ind + cur_s - 1;
    if (cur_p >= k * cur_s && (cur_p - k * cur_s) % k == 0) {
      x = (cur_p - k * cur_s) / k;
      if (x + cur_s <= nxt_s) ++res;
    }
    cur_s = nxt_s + more1[cur_last].second;
    if (cur_p > (long long)2e18 / more1[cur_last].second) return res;
    cur_p *= more1[cur_last].second;
    cur_ind = more1[cur_last].first;
    ++cur_last;
    ++cur_more1;
  }
  nxt_s = more1[cur_last].first - cur_ind + cur_s - 1;
  if (cur_p >= k * cur_s && (cur_p - k * cur_s) % k == 0) {
    x = (cur_p - k * cur_s) / k;
    if (x + cur_s <= nxt_s) ++res;
  }
  return res;
}
int main() {
  scanf("%lld%lld", &n, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &a[i]);
    if (a[i] > 1) more1.push_back(make_pair((long long)i, a[i]));
  }
  more1.push_back(make_pair((long long)n, 0));
  for (int i = 0; i < n; ++i) {
    if (i >= more1[last].first) ++last;
    ans += check_pos(i);
  }
  printf("%lld", ans);
  return 0;
}
