https://codeforces.com/contest/1042/problem/D
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll in()
{
ll res=0,p=1;
char c=getchar();
while(c<'0'||c>'9') {if(c=='-') p=-1; c=getchar();}
while(c>='0'&&c<='9') res=res*10+c-48,c=getchar();
return p*res;
}
void out(ll x)
{
if (x>9) out(x/10);
putchar(x%10+48);
}
const int maxn = 2e5 + 5;
pair<ll, int> a[maxn];
int n, T[maxn], pos[maxn];
int query(int x)
{
int sum = 0;
while(x){
sum += T[x];
x -= x & -x;
}
return sum;
}
void add(int x)
{
while (x <= n){
++T[x];
x += x & -x;
}
}
int main()
{
ll t;
n = in(), t = in();
for (int i = 1; i <= n; ++i){a[i].first = in() + a[i - 1].first; a[i].second = i;}
sort(a + 1, a + 1 + n);
for (int i = 1; i <= n; ++i) pos[a[i].second] = i;
ll ans = 0;
for (int i = n; i >= 1; --i){
add(pos[i]);
int p = lower_bound(a + 1, a + 1 + n, make_pair(t + a[pos[i - 1]].first, 0)) - (a + 1);
ans += query(p);
}
out(ans);
return 0;
}