#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 5;
const long long CONST = 2000000000000000000LL;
long long a[MAX_N], sum[MAX_N];
int nxt[MAX_N];
int main() {
  int pos, n;
  long long k, ans = 0, L, R;
  scanf("%d%lld", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    sum[i] = sum[i - 1] + a[i];
  }
  pos = n + 1;
  for (int i = n; i > 0; i--) {
    nxt[i] = pos;
    if (a[i] > 1) pos = i;
  }
  for (int i = 1; i <= n; i++) {
    long long mul = 1;
    for (int x = i; x <= n; x = nxt[x]) {
      L = (sum[x] - sum[i - 1]) * k;
      R = (sum[nxt[x] - 1] - sum[i - 1]) * k;
      if (CONST / mul < a[x]) break;
      mul *= a[x];
      if (mul >= L && mul <= R && (mul - L) % k == 0) ans++;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
