#include <bits/stdc++.h>   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   void JIZZ(string output =   ) {     cout << output;     exit(0);   }   const long double PI = 3.14159265358979323846264338327950288;   const long double eps = 1e-13;   const long long mod = 1e9 + 7;   long long a[200005], pre[200005];   vector<int> good;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     long long k;     cin >> n >> k;     for (int i = 1; i <= n; ++i) cin >> a[i];     for (int i = 1; i <= n; ++i) pre[i] = pre[i - 1] + a[i];     for (int i = 1; i <= n; ++i)       if (a[i] > 1) good.push_back(i);     good.push_back(n + 1);     if (0) {       long long ans = 0;       for (int i = 1; i <= n; ++i) {         long long s = 0, p = 1;         for (int j = i; j <= n; ++j) {           if (((long double)p) * a[j] > 2e18) break;           p *= a[j], s += a[j];           if (s * k == p) cout << i <<     << j << endl, ++ans;         }       }       cout << ans << endl;     }     long long ans = 0;     for (int i = 1; i <= n; ++i) {       long long p = a[i], s = a[i];       int now = i;       auto ptr = upper_bound(good.begin(), good.end(), i);       if (s * k <= p && p <= (s + *ptr - now) * k && p % k == 0) ++ans;       while (p <= 2e18) {         if (*ptr == n + 1) break;         if (((long double)p) * a[*ptr] > 2e18) break;         p *= a[*ptr];         s += pre[*ptr] - pre[now];         now = *ptr;         ++ptr;         if (s * k <= p && p <= (s + *ptr - now - 1) * k && p % k == 0) ++ans;       }     }     cout << ans << endl;   }   