#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 1;   const long long LIMIT = 2e18 + 1;   int n;   long long k;   long long arr[N];   long long cnt[N];   bool isUnsafe(long long a, long long b) {     return a > LIMIT / b || b > LIMIT / a;   }   int solve(int i) {     int res = 0;     long long s, p;     if (arr[i] != 1) {       s = k * arr[i];       p = arr[i];       res += (s == p);     } else {       s = k * cnt[i];       p = 1;       res += (k == 1);     }     for (++i; i < n; ++i) {       if (arr[i] == 1) {         long long sOld = s;         s += k * cnt[i];         if (sOld < p && s >= p && (p - sOld) % k == 0) {           ++res;         }       } else {         if (isUnsafe(p, arr[i])) {           break;         }         p *= arr[i];         s += k * arr[i];         if (s == p) {           ++res;         }       }     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> k;     for (int i = 0; i < n; ++i) {       cin >> arr[i];       if (i > 0 && arr[i] == 1 && arr[i - 1] == 1) {         --i;         --n;       }       ++cnt[i];     }     long long res = 0;     for (int i = 0; i < n; ++i) {       res += solve(i);       if (arr[i] == 1) {         --cnt[i];         if (cnt[i]) {           --i;         }       }     }     cout << res;     return 0;   }   