#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
inline void cmin(int &x, int y) {
  if (y < x) x = y;
}
inline void cmax(int &x, int y) {
  if (y > x) x = y;
}
long long mymul(long long a, long long b) {
  if (LL_INF / a < b) return LL_INF;
  return min(a * b, LL_INF);
}
long long in[200050];
long long sum[200050];
int nxt[200050];
int main() {
  int N, K, i;
  scanf("%d %d", &N, &K);
  for (i = 1; i <= N; i++) {
    scanf("%I64d", &in[i]);
    sum[i] = sum[i - 1] + in[i];
  }
  nxt[N + 1] = N + 1;
  for (i = N; i >= 1; i--) {
    nxt[i] = nxt[i + 1];
    if (in[i] > 1) nxt[i] = i;
  }
  long long ans = 0;
  for (i = 1; i <= N; i++) {
    long long v = in[i], st = i;
    while (v < 3e18) {
      long long en = nxt[st + 1] - 1;
      if (v % K == 0) {
        long long v2 = v / K + sum[i - 1];
        int p = lower_bound(sum + 1, sum + N + 1, v2) - sum;
        if (p != N + 1 && sum[p] == v2 && st <= p && p <= en) ans++;
      }
      if (en == N) break;
      st = en + 1;
      v = mymul(v, in[st]);
    }
  }
  return !printf("%I64d\n", ans);
}
