#include <bits/stdc++.h>
using namespace std;
int const N = 202020;
long long a[N];
long long l[N], r[N];
int main() {
  int n;
  long long k;
  scanf("%d%I64d", &n, &k);
  for (int i = 1; i <= (n); ++i) scanf("%I64d", &a[i]);
  for (int i = 1; i <= (n); ++i) l[i] = a[i - 1] == 1 ? 1 + l[i - 1] : 0;
  for (int i = n; i >= 1; --i) r[i] = a[i + 1] == 1 ? 1 + r[i + 1] : 0;
  long long mx = 0x3FFFFFFFFFFFFFFFLL;
  long long ans = 0;
  if (k == 1) {
    for (int i = 1; i <= (n); ++i)
      if (a[i] == 1) ++ans;
  }
  for (int i = 1; i <= (n); ++i)
    if (a[i] != 1) {
      long long ts = 0, tr = 1;
      for (int j = i; j <= n; ++j) {
        if (a[j] == 1) {
          ts += r[j - 1];
          j += r[j - 1];
          j -= 1;
          continue;
        }
        if (tr > mx / a[j]) break;
        ts += a[j];
        tr *= a[j];
        if (tr % k == 0) {
          long long need = tr / k - ts;
          if (need >= 0) {
            long long lc = min(need, l[i]), rc = min(need, r[j]);
            long long cnt = lc + rc - need + 1;
            cnt = max(cnt, 0LL);
            ans += cnt;
          }
        }
      }
    }
  cout << ans << endl;
  return 0;
}
