#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int MAXN = 100000;
const int LINF = 2000000000000000001;
//_ ***************************** START Below *******************************
vector<int> a;
//* Template1 for Atmost k (i.e. <= k )
//* We Start with Valid window
//* Keep expanding valid window and computing results (till it's valid)
//* Once it's invalid, keep shrinking untill it becomes valid again
//* On becoming valid, Compute result and epxand again
//* Count + Atmost K
//* Count subarrays with sum <= k
void consistency1(int n, int k){
int s = 0, e = 0;
int sum = 0;
int ans = 0;
while(e<n){
//* Calculate state
sum += a[e];
if(sum < k){
//* Valid Wndow => Compute Result && expand
ans += (e-s+1);
e++;
}
else if(sum==k){
//* Note : In problem we have sum<k as valid, not sum<=k as valid
//* Valid Wndow => Compute result && expand
ans += (e-s+1);
e++;
}
else{
//* Invalid window => Keep Shrink Window
//* Allow single element to be checked with s<=e
while(s<=e && sum>k){
//* Note : In problem we have sum<k as valid so it would be sum>=k
sum -= a[s];
s++;
}
//* Valid window => Compute Result && expand
if(sum<=k) ans += (e-s+1);
e++;
}
}
cout << ans << endl;
}
//* Template2 for Atmost k (i.e. <= k )
//* (based on Cache Invalidation)
//* We Start with Valid window
//* If Window is Invalid
//* (similar to Cache Invalidation)
//* Keep shrinking till it becomes valid
//* Now window is becomes valid
//* Compute result
void consistency2(int n, int k){
int sum = 0;
int ans = 0;
for(int s=0, e=0; e<n; e++){
//* Calculate state
sum += a[e];
//* Invalid window => Shrink
//* Allow single element to be checked with s<=e
while(s<=e && sum>k){
//* Note : In problem we have sum<k as valid so it would be sum>=k
sum -= a[s];
s++;
}
//* Valid window guranteed => Compute Result
//* Note : In problem we have sum<k as valid, not sum<=k as valid
if(sum<=k) ans += (e-s+1);
}
cout << ans << endl;
}
void solve() {
int n, k;
cin >> n >> k;
a.resize(n);
for(int i=0; i<n; i++) cin >> a[i];
consistency1(n, k);
consistency2(n, k);
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t = 1;
while (t--) {
solve();
}
return 0;
}