#include <bits/stdc++.h>
#define ll long long
#define nmax 1000005
#define mod 1000000007
#define tt ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
#define co cout<<"Yes";
#define ko cout<<"No";return 0;
#define NAME "QUYLUAT"
using namespace std;
ll n,x;
ll a[nmax];
ll tong=0,dem=0;
int main()
{
    tt;
    if(fopen(NAME".inp","r"))
    {
        freopen(NAME".inp","r",stdin);
        freopen(NAME".out","w",stdout);
    }
    cin>>n>>x;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    int l=1;
    for(int r=1;r<=n;r++)
    {
            tong+=a[r];
        while(tong>x)
        {
            tong-=a[l];
            l++;
        }
        dem+=(r-l+1);
    }
    cout<<dem;
    return 0;
}
