#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 50;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
long long n, k;
long long a[maxn];
int vis[maxn];
long long ans = 0;
bool Overflow(long long x, long long y) {
  if (x > LLONG_MAX / y)
    return false;
  else
    return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(vis, 0, sizeof(vis));
  memset(a, 0, sizeof(a));
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vis[n + 1] = -1;
  for (int i = n; i >= 1; i--) {
    if (a[i] > 1)
      vis[i] = i;
    else
      vis[i] = vis[i + 1];
  }
  long long p = 1;
  long long s = 0;
  for (int i = 1; i <= n; i++) {
    int j = i;
    p = a[i];
    s = a[i];
    if (p == s * k) ans++;
    while (1) {
      int z = vis[j + 1];
      if (z == -1) z = n + 1;
      int ones = z - j - 1;
      if (p % k == 0 && p / k - s >= 1 && p / k - s <= ones) {
        ans++;
      }
      if (z == n + 1) break;
      if (Overflow(p, a[z])) {
        p = p * a[z];
        j = z;
        s = s + a[z] + ones;
        if (p == s * k) ans++;
      } else
        break;
    }
  }
  cout << ans << endl;
  return 0;
}
