#include <bits/stdc++.h>
using namespace std;
long long a[200010], sum[200010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  vector<int> pos;
  for (int i = 1; i <= n; i++)
    if (a[i] > 1) pos.push_back(i);
  int tot = pos.size();
  long long ans = 0;
  for (int i = 0; i < tot; i++) {
    long long p = a[pos[i]], s;
    for (int j = i + 1; j < tot; j++) {
      if (k * sum[n] / a[pos[j]] <= p) break;
      p *= a[pos[j]];
      s = sum[pos[j]] - sum[pos[i] - 1];
      if (p == s * k)
        ans++;
      else if (p > s * k) {
        if ((p - k * s) % k) continue;
        long long l, r;
        if (!i)
          l = pos[i] - 1;
        else
          l = pos[i] - pos[i - 1] - 1;
        if (j == tot - 1)
          r = n - pos[j];
        else
          r = pos[j + 1] - pos[j] - 1;
        long long need = (p - k * s) / k;
        if (l + r >= need) ans += min(l, need) - max(0LL, need - r) + 1;
      }
    }
  }
  if (k == 1) ans += n;
  cout << ans;
  return 0;
}
