#include <bits/stdc++.h>
const int sz = 200010;
long long a[sz];
int l[sz], r[sz];
std::vector<int> ze;
long long inf = 2e18;
int main() {
  int n;
  long long m;
  scanf("%d%lld", &n, &m);
  for (int k = 1; k <= n; k++) scanf("%lld", &a[k]);
  int pre = 0;
  int cnt = 0;
  a[n + 1] = 1000000000;
  for (int k = 1; k <= n + 1; k++) {
    if (a[k] == 1) {
      cnt++;
      continue;
    }
    r[pre] = cnt;
    l[k] = cnt;
    if (cnt > 0) ze.push_back(cnt);
    cnt = 0;
    pre = k;
  }
  long long ans = 0;
  for (int k = 1; k <= n; k++) {
    if (a[k] == 1) continue;
    long long now = 1, sum = 0;
    long long L = (long long)l[k];
    for (int i = k; i <= n; i++) {
      long long R = (long long)r[i];
      if (a[i] >= inf / now) break;
      sum += a[i];
      now *= a[i];
      if (now % m != 0) {
        sum += r[i];
        i += r[i];
        continue;
      }
      long long y = now / m - sum;
      if (y < 0) {
        sum += r[i];
        i += r[i];
        continue;
      }
      if (L + R < y) {
        sum += r[i];
        i += r[i];
        continue;
      }
      long long LL = L, RR = R;
      if (LL > y) LL = y;
      if (RR > y) RR = y;
      long long x = LL + RR - y + 1;
      if (LL + 1 < x) x = LL + 1;
      if (RR + 1 < x) x = RR + 1;
      ans += x;
      sum += r[i];
      i += r[i];
    }
  }
  if (m == 1) {
    for (int k = 0; k < ze.size(); k++) {
      ans += (long long)ze[k];
    }
  }
  printf("%lld\n", ans);
}
