#include <bits/stdc++.h>
using namespace std;
long long powm(long long base, long long exp, long long mod = 1000000007) {
  long long ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base) % mod;
    exp >>= 1, base = (base * base) % mod;
  }
  return ans;
}
long long ctl(char x, char an = 'a') { return (long long)(x - an); }
char ltc(long long x, char an = 'a') { return (char)(x + an); }
long long a[1000005], nxt[1000005], suff[1000005];
bool overflow(long long a, long long b) {
  long double ta = a, tb = b;
  if (3e18 / ta < tb) return 1;
  return 0;
}
int main() {
  long long n, k, ans = 0;
  cin >> n >> k, nxt[n + 1] = n + 1;
  for (long long i = 1; i < n + 1; i++) cin >> a[i];
  for (long long i = n; i >= 1; i--) {
    suff[i] = suff[i + 1] + a[i];
    if (a[i] == 1)
      nxt[i] = nxt[i + 1];
    else
      nxt[i] = i;
  }
  for (long long i = 1; i < n + 1; i++) {
    long long p = 1, second = 0;
    long long iter = 0;
    for (long long j = i; j < n + 1; j++) {
      if (a[j] == 1) {
        long long tot_ones = nxt[j] - j;
        if (p % k == 0) {
          long long req_ones = p / k - second;
          if (req_ones > 0 and req_ones <= tot_ones) {
            ans++;
          }
        }
        j = nxt[j] - 1;
        second += tot_ones;
      } else {
        if (overflow(p, a[j])) break;
        p *= a[j];
        second += a[j];
        if (p == k * second) ans++;
      }
      if (p > k * suff[i]) break;
    }
  }
  cout << ans;
  return 0;
}
