#include <bits/stdc++.h>
using namespace std;
int n, nxt[200005], at, to;
long long k, p;
long long x[200005], y[200005];
long long ans;
int main() {
  scanf("%d%lld", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%lld", x + i);
    y[i + 1] = y[i] + x[i];
  }
  nxt[n] = n;
  for (int i = n - 1; i >= 0; i--)
    if (x[i] == 1)
      nxt[i] = nxt[i + 1];
    else
      nxt[i] = i;
  for (int i = 0; i < n; i++) {
    p = 1;
    at = i;
    while (at < n)
      if (x[at] == 1) {
        to = nxt[at];
        if (p % k == 0 && binary_search(y + at + 1, y + to + 1, p / k + y[i]))
          ans++;
        at = to;
      } else {
        if (p > LLONG_MAX / x[at]) break;
        p *= x[at];
        at++;
        if (p == (y[at] - y[i]) * k) ans++;
      }
  }
  printf("%lld\n", ans);
  return 0;
}
