#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  vector<long long> b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long ans = 0;
  if (k == 1) {
    for (int i = 0; i < n; ++i) {
      if (a[i] == 1) {
        ++ans;
      }
    }
  }
  int len = 0;
  int current = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == 1) {
      ++current;
    } else {
      if (current > 0) {
        b[len] = -current;
        ++len;
      }
      current = 0;
      b[len] = a[i];
      ++len;
    }
  }
  if (current > 0) {
    b[len] = -current;
    ++len;
  }
  long long left, right, prod, sum, necessary;
  for (int i = 0; i < len; ++i) {
    if (b[i] < 0) {
      continue;
    }
    sum = 0, prod = 1;
    for (int j = i; j < len; ++j) {
      if (b[j] < 0) {
        sum += -b[j];
        continue;
      }
      if (prod > ((long long)2) * 100000 * 100000000 / b[j]) {
        break;
      }
      prod *= b[j], sum += b[j];
      if (prod % k != 0) {
        continue;
      }
      left = 0;
      if (i > 0 && b[i - 1] < 0) {
        left = -b[i - 1];
      }
      right = 0;
      if (j < n - 1 && b[j + 1] < 0) {
        right = -b[j + 1];
      }
      long long necessary = prod / k - sum;
      for (long long lefti = 0; lefti <= left; lefti++) {
        long long residue = necessary - lefti;
        if (residue >= 0 && residue <= right) {
          ++ans;
        }
      }
    }
  }
  cout << ans;
  return 0;
}
