#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n;
long long ans, a[N], t;
inline void cdq(int x, int y) {
  if (x == y) return;
  int mid = (x + y) >> 1;
  cdq(x, mid);
  cdq(mid + 1, y);
  int l = x, lr = mid + 1, r = y;
  while (l <= mid && lr <= y)
    if (a[l] + t <= a[lr])
      l++;
    else
      ans += mid - l + 1, lr++;
  sort(a + x, a + y + 1);
}
int main(void) {
  scanf("%d%lld", &n, &t);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    a[i + 1] = a[i] + x;
  }
  cdq(1, n + 1);
  printf("%lld\n", ans);
  return 0;
}
