#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long t, s[N], ans, tmp[N];
int n, a[N];
void mergeSort(int a, int b, long long s[]) {
  if (a >= b) {
    return;
  }
  int m = (a + b) / 2;
  mergeSort(a, m, s);
  mergeSort(m + 1, b, s);
  int l = a, pl = a, r = m + 1, pr = m + 1;
  for (int i = a; i <= b; ++i) {
    if (r > b || (l <= m && s[l] < s[r])) {
      while (pr <= b && s[pr] - s[l] < t) {
        ++pr;
      }
      ans += pr - r;
      tmp[i] = s[l++];
      pl = max(pl, l);
    } else {
      while (pl <= m && s[r] - s[pl] >= t) {
        ++pl;
      }
      ans += m - pl + 1;
      tmp[i] = s[r++];
      pr = max(pr, r);
    }
  }
  for (int i = a; i <= b; ++i) {
    s[i] = tmp[i];
  }
}
void solveTest() {
  cin >> n >> t;
  s[0] = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    s[i] = s[i - 1] + a[i];
  }
  ans = 0;
  mergeSort(0, n, s);
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  solveTest();
  return 0;
}
