#include <bits/stdc++.h>
using namespace std;
long long pi = 1, sum = 0, n, k, a[200100], pos[200100];
const long long inf = (long long)1e19;
int main() {
  scanf("%I64d %I64d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    pos[i] = (a[i - 1] != 1 ? i - 1 : pos[i - 1]);
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    pi = sum = a[i];
    ans += (k == 1);
    for (long long now = pos[i], pre = i;; pre = now, now = pos[now]) {
      long long mid = pi - sum * (long long)k;
      if (mid > 0 && mid % k == 0 && mid / k < pre - now) ans++;
      if (!now || inf / a[now] < pi) break;
      pi *= (long long)a[now];
      sum += a[now] + pre - now - 1;
      ans += (pi == sum * (long long)k);
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
