#include <bits/stdc++.h>
using namespace std;
long long n, k, a[202020], nx[202020], tempe, tempe1, tempe2, has, jangan, te,
    j, i, ta;
long long kal(long long aa, long long bb) {
  if (bb == 0)
    return 0;
  else {
    long long tem = kal(aa, bb / 2);
    tem += tem;
    if (bb % 2 == 1) {
      tem += aa;
    }
    if (tem > 1e18) jangan = 1;
    return tem;
  }
}
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  tempe = n + 1;
  for (i = n; i >= 1; i--) {
    nx[i] = tempe;
    if (a[i] != 1) tempe = i;
  }
  for (i = 1; i <= n; i++) {
    tempe1 = a[i];
    tempe2 = a[i];
    if (k == 1) has++;
    jangan = 0;
    te = 0;
    j = i;
    while (1) {
      if (jangan || te > 40 || j == n + 1) break;
      if (nx[j] != j + 1) {
        if ((tempe1 - tempe2 * k > 0) && ((tempe1 - tempe2 * k) % k == 0)) {
          long long hai = (tempe1 - tempe2 * k) / k, lee = 1,
                    ree = nx[j] - j - 1;
          if (lee <= hai && hai <= ree) has++;
        }
        te++;
        kal(tempe1, a[nx[j]]);
        if (jangan) break;
        tempe1 *= a[nx[j]];
        tempe2 += a[nx[j]];
        tempe2 += nx[j] - j - 1;
        if (k * tempe2 == tempe1) has++;
        j = nx[j];
      } else {
        te++;
        if (nx[j] == n + 1) break;
        kal(tempe1, a[nx[j]]);
        if (jangan) break;
        tempe1 *= a[nx[j]];
        tempe2 += a[nx[j]];
        if (k * tempe2 == tempe1) has++;
        j = nx[j];
      }
    }
  }
  cout << has << "\n";
}
