#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 2e5 + 5;
const long long INF = (1LL << 62);
const long double pi = 3.14159265359;
void SRAND() {
  auto duration = std::chrono::system_clock::now().time_since_epoch();
  auto millis =
      std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
  srand(millis);
}
long long n, k, u[N], p[N], ans, x, y;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> u[i];
  for (long long i = n; i >= 1; i--) {
    p[i] = (u[i] == 1 ? p[i + 1] + 1 : 0);
  }
  for (long long i = 1; i <= n; i++) {
    x = u[i];
    y = u[i];
    if (x == y * k) ans++;
    for (long long j = i + 1; j <= n; j++) {
      if (u[j] == 1) {
        if (x % k == 0 && (x - k * y) / k >= 1 && (x - k * y) / k <= p[j])
          ans++;
        y += p[j];
        j += p[j] - 1;
        continue;
      }
      if (x >= INF / u[j]) break;
      x *= u[j];
      y += u[j];
      if (x == y * k) ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}
