#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long a[N], bit[N];
set<long long> psum;
map<long long, long long> idx;
void add(long long idx) {
  for (; idx < N; idx = idx | (idx + 1)) bit[idx]++;
  return;
}
long long sum(long long r) {
  long long res = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) res += bit[r];
  return res;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, t, j;
  cin >> n >> t;
  long long val = 0;
  psum.insert(0);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    val += a[i];
    psum.insert(val);
  }
  long long ans = 0;
  val = 0;
  for (auto &x : psum) {
    idx[x] = val;
    val++;
  }
  val = 0;
  add(idx[*psum.lower_bound(0)]);
  for (long long i = 0; i < n; i++) {
    val += a[i];
    if (psum.upper_bound(val - t) != psum.end())
      j = idx[(*psum.upper_bound(val - t))];
    else
      j = (long long)psum.size() + 1;
    ans += (i + 1 - sum(j - 1));
    j = idx[*psum.lower_bound(val)];
    add(j);
  }
  cout << ans << '\n';
  return 0;
}
