#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[200010];
int vis[200010];
ll ans;
int main()
{
    ll n,k;
    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)
       scanf("%lld",&a[i]);
    vis[n+1]=-1;
    for(int i=n;i>=1;i--)
    {
        if(a[i]>1)
           vis[i]=i;
        else
           vis[i]=vis[i+1];//从这个数字开始第一个大于1的数字 
    }
    for(int i=1;i<=n;i++)
    {
        int j=i;
        ll p=a[j];
        ll s=a[j];
        if(p==s*k)
           ans++;
        while(true)
        {
            ll pos=vis[j+1];
            if(pos==-1)
               pos=n+1;
            ll ones=pos-j-1;
            if(p%k==0&&p/k>=s+1&&p/k<=s+ones)
               ans++;
            if(pos==n+1)
               break;
            if((double)p*(double)a[pos]>2e18)
               break;
            j=pos;
            p*=a[j];
            s+=a[j]+ones;
            if(p==s*k) ans++;
        }
    }
    printf("%lld\n",ans);
}