#include <bits/stdc++.h>
using namespace std;
const long long LIM = 7e18;
bool overflow(long long a, long long b) {
  if (a >= LIM / b) return true;
  return false;
}
long long brute(vector<long long> &v, long long k) {
  long long ans = 0;
  int n = v.size() - 1;
  for (int i = 0; i < v.size(); i++) {
    long long p = 1, s = 0;
    for (int j = i; j < v.size(); j++) {
      if (overflow(p, v[j])) break;
      s += v[j];
      p *= v[j];
      if (p % s == 0 && p / s == k) ans++;
    }
  }
  return ans;
}
int main() {
  int n;
  long long k;
  cin >> n >> k;
  vector<long long> v(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  v[n] = 5e18;
  vector<int> nxt(n + 1);
  nxt[n] = n;
  int last = n;
  for (int i = n - 1; i >= 0; i--) {
    nxt[i] = last;
    if (v[i] > 1) last = i;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int j = i;
    long long P = 1, S = 0;
    while (j < n && !overflow(P, v[j])) {
      S += v[j];
      P *= v[j];
      if (P % S == 0 && P / S == k) ans++;
      long long need = (P - S * k) / k;
      if (need > 0 && nxt[j] - j - 1 >= need && (P - S * k) % k == 0) ans++;
      S += nxt[j] - j - 1;
      j = nxt[j];
    }
  }
  cout << ans << '\n';
}
