#include<bits/stdc++.h>usingnamespace std;#define FOR0(a,b) for(int i = a; i < b; ++i)#define FORE(a,b) for(int i = a; i <= b; ++i)typedeflonglong ll;typedef pair<int,int> pii;constint maxn =3e5+5;int n,m,tot;
ll a[maxn];
ll pre[maxn];
ll c[maxn];intf(ll x){returnint(lower_bound(pre,pre+tot,x)-pre)+1;}intlowbit(int x){return x&(-x);}voidadd(int x){while(x <= tot+1){
c[x]+=1;
x +=lowbit(x);}}
ll sum(int x){
ll ret =0;while(x >0){
ret += c[x];
x -=lowbit(x);}return ret;}intmain(){scanf("%d%d",&n,&m);for(int i =1; i <= n;++i){scanf("%lld",&a[i]);}for(ll i =1; i <= n;++i){
a[i]+= a[i-1];
pre[i]= a[i];}sort(pre,pre+n+1);
tot =unique(pre,pre+n+1)-pre;add(f(0));
ll ans =0;for(int i =1; i <= n;++i){
ll t =upper_bound(pre,pre+tot,a[i]-m)-pre;// cout << a[i]-m <<" " << t << endl;
ans +=sum(tot+1)-sum(t);add(f(a[i]));// cout << ans << endl;}
cout << ans << endl;return0;}