#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400005;
int N;
long long T;
long long A[MAXN];
long long pre[MAXN];
map<long long, int> mp;
int BIT[MAXN];
void add(int idx) {
  for (; idx < MAXN; idx += idx & -idx) BIT[idx]++;
}
int get(int idx) {
  int ret = 0;
  for (; idx > 0; idx -= idx & -idx) ret += BIT[idx];
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> N >> T;
  mp[-T] = 1;
  mp[0] = 1;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    pre[i] = pre[i - 1] + A[i];
    mp[pre[i] - T] = 1;
    mp[pre[i]] = 1;
  }
  int ind = 0;
  for (map<long long, int>::iterator it = mp.begin(); it != mp.end(); it++)
    it->second = ++ind;
  long long ans = 0;
  add(mp[0]);
  for (int i = 1; i <= N; i++) {
    ans += i - get(mp[pre[i] - T]);
    add(mp[pre[i]]);
  }
  cout << ans << "\n";
  return 0;
}
