#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& s, vector<T> const& v) {
  s << '{';
  for (int i = 0; i < int(v.size()); i++) s << (i ? "," : "") << v[i];
  return s << '}';
}
template <typename S, typename T>
ostream& operator<<(ostream& s, pair<S, T> const& p) {
  return s << '(' << p.first << ',' << p.second << ')';
}
const long long LIM = 2000000000000000000LL;
int main() {
  int N, K;
  scanf("%d%d", &N, &K);
  vector<pair<int, int> > A;
  for (int n = 0; n < int(N); n++) {
    int x;
    scanf("%d", &x);
    if (A.empty() || x > 1 || A.back().first != 1) {
      A.emplace_back(x, 1);
    } else {
      A.back().second++;
    }
  }
  int ans = 0;
  for (int i = 0; i < int(((int)(A).size())); i++) {
    if (A[i].first == 1) {
      if (K == 1) ans += A[i].second;
      continue;
    }
    long long p = 1, s = 0;
    for (int j = i; j < int(((int)(A).size())); j++) {
      if (LIM / A[j].first < p) break;
      p *= A[j].first;
      if (A[j].first == 1) {
        s += A[j].second;
      } else {
        s += A[j].first;
        if (p % s == 0 && p / s == K) {
          ans++;
        } else if (p % K == 0) {
          long long pk = p / K;
          if (pk > s) {
            long long fs = 0;
            if (i > 0 && A[i - 1].first == 1)
              fs += min(pk - s, (long long)A[i - 1].second);
            if (j + 1 < ((int)(A).size()) && A[j + 1].first == 1)
              fs += min(pk - s, (long long)A[j + 1].second);
            ans += (int)max(0LL, fs - (pk - s) + 1);
          }
        }
      }
    }
  }
  printf("%d\n", ans);
}
