#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const double lim = 2e13;
int n, k, cnt, ans;
int a[maxn], num[maxn], st[maxn], ed[maxn], nxt[maxn];
pair<int, int> seg[maxn];
int check(const long long &prod, const long long &sum, const int &st,
          const int &ed) {
  if (prod % k) return 0;
  long long tmp = prod / k;
  int a = st ? num[st] : 0, b = ed ? num[ed + 1] : 0, c = tmp - sum;
  if (c >= 0 && tmp <= sum + a + b) {
    int x = max(0, c - b), y = min(a, c);
    return y - x + 1;
  }
  return 0;
}
void force() {
  puts("----force-----");
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    long long prod = 1, sum = 0;
    for (int j = i; j <= n; ++j) {
      if (prod > lim / a[i]) break;
      prod *= a[j];
      sum += a[j];
      if (prod == sum * k) ++res, printf("%d %d\n", i, j);
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), nxt[i] = i + 1;
  for (int L = 1, R; L <= n; ++L) {
    while (L <= n && a[L] == 1) ++L;
    if (L > n) break;
    R = L;
    while (R < n && a[R + 1] > 1) ++R;
    seg[++cnt] = make_pair(L, R);
    L = R + 1;
  }
  for (int i = 1; i <= cnt; ++i) {
    st[seg[i].first] = ed[seg[i].second] = i;
    nxt[seg[i].second] = i == cnt ? n + 1 : seg[i + 1].first;
    num[i] = seg[i].first - seg[i - 1].second - 1;
  }
  num[cnt + 1] = n - seg[cnt].second;
  if (k == 1)
    for (int i = 1; i <= cnt + 1; ++i) ans += num[i];
  if (cnt)
    for (int i = seg[1].first; i <= n; i = nxt[i]) {
      long long prod = 1, sum = 0;
      int len = 1;
      for (int j = i; j <= n && len <= 60; ++len, j = nxt[j]) {
        if (prod > lim / a[j]) break;
        prod *= a[j];
        sum += a[j];
        ans += check(prod, sum, st[i], ed[j]);
        if (ed[j]) sum += num[ed[j] + 1];
      }
    }
  printf("%d\n", ans);
  return 0;
}
