#include <bits/stdc++.h>
using namespace std;
long long int ans = 0;
long long int inf = 1e19;
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> v(n);
  for (long long int j = 0; j < n; j++) cin >> v[j];
  vector<long long int> dp(n, 0);
  if (v[n - 1] == 1) {
    dp[n - 1] = 1;
  }
  for (long long int j = n - 2; j >= 0; j--) {
    dp[j] = (dp[j + 1] + 1) * (v[j] == 1);
  }
  for (long long int j = 0; j < n; j++) {
    long long int cnt = 0;
    long long int i = j;
    long long int s = 0, m = 1;
    while (i < n) {
      if (v[i] == 1) {
        if (s * k < m && (s + dp[i]) * k >= m) {
          if ((m - s * k) % k == 0) {
            ans++;
          }
        }
        s += dp[i];
        i += dp[i];
      } else {
        s += v[i];
        if (m <= inf / v[i]) {
          m *= v[i];
        } else {
          break;
        }
        if (s * k == m) {
          ans++;
        }
        i++;
        cnt++;
      }
      if (cnt > 61) {
        break;
      }
    }
  }
  cout << ans << "\n";
  return;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
