#include <bits/stdc++.h>
using namespace std;
const int MAXN = 212345;
vector<pair<int, int> > v;
int main() {
  ios::sync_with_stdio(false);
  int n;
  long long k, tsum = 0;
  cin >> n >> k;
  for (int i = 0; i < (n); ++i) {
    int x;
    cin >> x;
    if (x == 1 && !v.empty() && v.back().first == 1)
      ++v.back().second;
    else
      v.push_back({x, 1});
    tsum += x;
  }
  n = (int)((v).size());
  long long ans = 0;
  for (int i = 0; i < (n); ++i) {
    while (v[i].second >= 1) {
      long long cp = 1, csum = 0;
      for (int j = i; j < (n); ++j) {
        long long p = v[j].first;
        long long qtd = v[j].second;
        if (p != 1) {
          long long limp = k * 10000000000000 / cp;
          if (p > limp) break;
          cp *= p;
          csum += p;
          if (cp == csum * k) ++ans;
        } else {
          long long num = cp - k * csum;
          if (num % k == 0) {
            long long x = num / k;
            if (x >= 1 && x <= qtd) ++ans;
          }
          csum += qtd;
        }
      }
      --v[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}
