#include <bits/stdc++.h>
using namespace std;
long long A[200006], nextGood[200006];
long long K;
bool Overflow(long long a, long long b) {
  if (a <= ((long long)2e18) / b) return false;
  return true;
}
int main() {
  int N, i, j, k;
  cin >> N >> K;
  for (i = 1; i <= N; i++) cin >> A[i];
  nextGood[N + 1] = N + 1;
  for (i = N; i >= 1; i--) {
    if (A[i] == 1)
      nextGood[i] = nextGood[i + 1];
    else
      nextGood[i] = i;
  }
  int ans = 0;
  for (i = 1; i <= N; i++) {
    int ptr = i;
    long long sum = 0;
    long long pro = 1;
    while (1) {
      sum += A[ptr];
      pro *= A[ptr];
      if (pro == sum * K) ans++;
      ptr++;
      if (A[ptr] == 1) {
        long long ones = nextGood[ptr] - ptr;
        long long req = pro - sum * K;
        if (req > 0 && ones * K >= req && req % K == 0) ans++;
        sum += ones;
        ptr = nextGood[ptr];
      }
      if (ptr > N) break;
      if (Overflow(A[ptr], pro)) break;
    }
  }
  cout << ans << "\n";
  return 0;
}
