cpp
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 10;
ll a[N];
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll n,k;
cin >> n >> k;
for(int i = 1; i <= n; i++) cin >> a[i];
int left = 1;
ll sum = 0;
ll ans = 0;
for(int right = 1; right <= n; right++){
sum += a[right];
while(sum >= k){
sum -= a[left];
left++;
}
ans += left - 1;
}
cout << ans;
return 0;
}