#include <bits/stdc++.h>

using namespace std;

const int N = (int)1e5;
const int maxn = (int)5e5;
const long long INF = (long long)1e17;

long long n, S, a[N + 5], sum[N + 5], BIT1[maxn + 5], BIT2[maxn + 5], ans;
vector<long long>coor;

void update1(int x, int val){
	for(; x > 0; x -= x & -x) BIT1[x] += val;
}
void update2(int x, int val){
	for(; x <= maxn; x += x & -x) BIT2[x] += val;
}
long long get1(int x){
	long long s = 0;
	for(; x <= maxn; x += x & -x) s += BIT1[x];
	return s;
}
long long get2(int x){
	long long s = 0;
	for(; x > 0; x -= x & -x) s += BIT2[x];
	return s;
}
void nhap(){
	cin >> n >> S;
	for(int i = 1; i <= n; i++) cin >> a[i];
}
void prepare(){
	coor.push_back(-INF);
	for(int i = 0; i <= n; i++){
		if(i != 0) sum[i] = sum[i - 1] + a[i];
		coor.push_back(sum[i]);
		coor.push_back(sum[i] - S);
		coor.push_back(sum[i] + S);
	}
	sort(coor.begin(), coor.end());
}
void solve(){
	int tmp;
	for(int R = 0; R <= n; R++){
		tmp = lower_bound(coor.begin(), coor.end(), S + sum[R]) - coor.begin();
		ans += get1(tmp);
		tmp = lower_bound(coor.begin(), coor.end(), sum[R] - S) - coor.begin();
		ans += get2(tmp);
		tmp = lower_bound(coor.begin(), coor.end(), sum[R]) - coor.begin();
		update1(tmp - 1, 1);
		update2(tmp + 1, 1);
	}
	cout << ans;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	nhap();
	prepare();
	solve();
	return 0;
}