#include <bits/stdc++.h>
using namespace std;
const long long md = 1000000007;
long long k, a[1000000], K[1000000];
long long nx[1000000], n;
bool bad(long long a, long long b) {
  if (1000000000000000000 / b <= a)
    return true;
  else
    return false;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n >> k;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    K[i] = 1;
  }
  for (long long i = 0; i < n;) {
    if (a[i] != 1) {
      nx[i] = i + 1;
      i++;
      continue;
    }
    long long j = i;
    while (j < n && a[j] == 1) j++;
    for (long long kk = i; kk < j; kk++) {
      nx[kk] = j;
      K[kk] = j - kk;
    }
    i = j;
  }
  for (long long i = 0; i < n; i++) {
    long long p = 1, s = 0;
    for (long long j = i; j < n; j = nx[j]) {
      if (bad(p, a[j])) break;
      if (K[j] != 1) {
        if (p >= k * s && (p - k * s) % k == 0) {
          long long t = (p - k * s) / k;
          if (t > 0 && t <= K[j]) ans++;
        }
        s += K[j];
      } else {
        p *= a[j];
        s += a[j];
        if (k * s == p) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
