#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cassert>
#include <queue>
using namespace std;
#define forr(i, a, b) for(ll i = (a); i < (ll) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define fst first
#define snd second
#define SZ(x) ((ll)x.size())
typedef long long ll;
#define dforn(i, n) for(ll i = n - 1; i >= 0; i--)
const ll MAXN = 200200;
const ll INF = (ll)1e18;
ll n,k,A[MAXN],B[MAXN],bn,real[MAXN],L[MAXN],R[MAXN];
ll add[MAXN];
bool OF(ll a, ll b){
return a > (INF+b-1)/b;
}
int main() {
//~ freopen("input.in", "r", stdin);
while( scanf("%lld%lld", &n,&k) >= 1 ){
ll ans=0;bn=0;add[0]=0;
forn(i,n){
scanf("%lld",&A[i]);
add[i+1]=add[i]+A[i];
}
ll cnt=0;
forn(i,n){
if(A[i]>1){
B[bn]=A[i];
L[bn]=cnt;
real[bn]=i;
bn++;
cnt=0;
} else {
if(k==1)ans++;
cnt++;
}
}
cnt=0;
ll pnt=bn-1;
dforn(i,n){
if(A[i]>1){
R[pnt--]=cnt;
cnt=0;
} else {
cnt++;
}
}
//~ printf("bn=%lld\n",bn);
forn(i,bn){
ll p=1LL;
forr(j,i,bn){
if(OF(p,B[j]))break;
p*=B[j];
if(p%k)continue;
ll s = add[real[j]+1]-add[real[i]];
ll t=p/k-s;
//~ printf("[%lld,%lld] = %lld, p=%lld,t=%lld\n",i,j,s,p,t);
if(t<0)continue;
if(t==0){
ans++;
continue;
}
ll LL=L[i];
ll RR=R[j];
if(LL+RR<t)continue;
ll mm=min(LL,RR);
ll MM=max(LL,RR);
//~ printf("so far mm=%lld, MM=%lld\n",mm,MM);
mm=min(t,mm);
MM=min(t,MM);
ans+=min(mm+1,MM-(t-mm)+1);
//~ if(mm==t)ans++;
//~ if(MM==t)ans++;
//~ printf("Entre %lld y %lld, p=%lld, s=%lld, mm=%lld, MM=%lld t=%lld\n",i,j,p,s,mm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k7CiAgICAgIGFkZFtpKzFdPWFkZFtpXStBW2ldOwogICAgfQogICAgbGwgY250PTA7CiAgICBmb3JuKGksbil7CiAgICAgIGlmKEFbaV0+MSl7CiAgICAgICAgQltibl09QVtpXTsKICAgICAgICBMW2JuXT1jbnQ7CiAgICAgICAgcmVhbFtibl09aTsKICAgICAgICBibisrOwogICAgICAgIGNudD0wOwogICAgICB9IGVsc2UgewogICAgICAgIGlmKGs9PTEpYW5zKys7CiAgICAgICAgY250Kys7CiAgICAgIH0KICAgIH0KICAgIGNudD0wOwogICAgbGwgcG50PWJuLTE7CiAgICBkZm9ybihpLG4pewogICAgICBpZihBW2ldPjEpewogICAgICAgIFJbcG50LS1dPWNudDsKICAgICAgICBjbnQ9MDsKICAgICAgfSBlbHNlIHsKICAgICAgICBjbnQrKzsKICAgICAgfQogICAgfQogICAgLy9+IHByaW50ZigiYm49JWxsZFxuIixibik7CiAgICBmb3JuKGksYm4pewogICAgICBsbCBwPTFMTDsKICAgICAgZm9ycihqLGksYm4pewogICAgICAgIGlmKE9GKHAsQltqXSkpYnJlYWs7CiAgICAgICAgcCo9QltqXTsKICAgICAgICBpZihwJWspY29udGludWU7CiAgICAgICAgbGwgcyA9IGFkZFtyZWFsW2pdKzFdLWFkZFtyZWFsW2ldXTsKICAgICAgICBsbCB0PXAvay1zOwogICAgICAgIC8vfiBwcmludGYoIlslbGxkLCVsbGRdID0gJWxsZCwgcD0lbGxkLHQ9JWxsZFxuIixpLGoscyxwLHQpOwogICAgICAgIGlmKHQ8MCljb250aW51ZTsKICAgICAgICBpZih0PT0wKXsKICAgICAgICAgIGFucysrOwogICAgICAgICAgY29udGludWU7CiAgICAgICAgfQogICAgICAgIGxsIExMPUxbaV07CiAgICAgICAgbGwgUlI9UltqXTsKICAgICAgICBpZihMTCtSUjx0KWNvbnRpbnVlOwogICAgICAgIGxsIG1tPW1pbihMTCxSUik7CiAgICAgICAgbGwgTU09bWF4KExMLFJSKTsKICAgICAgICAvL34gcHJpbnRmKCJzbyBmYXIgbW09JWxsZCwgTU09JWxsZFxuIixtbSxNTSk7CiAgICAgICAgbW09bWluKHQsbW0pOwogICAgICAgIE1NPW1pbih0LE1NKTsKICAgICAgICBhbnMrPW1pbihtbSsxLE1NLSh0LW1tKSsxKTsKICAgICAgICAvL34gaWYobW09PXQpYW5zKys7CiAgICAgICAgLy9+IGlmKE1NPT10KWFucysrOwogICAgICAgIC8vfiBwcmludGYoIkVudHJlICVsbGQgeSAlbGxkLCBwPSVsbGQsIHM9JWxsZCwgbW09JWxsZCwgTU09JWxsZCB0PSVsbGRcbiIsaSxqLHAscyxtbSxNTSx0KTsKICAgICAgfQogICAgfQogICAgcHJpbnRmKCIlbGxkXG4iLGFucyk7CiAgfQogIHJldHVybiAwOwp9