#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n;
long long a[maxn], pre[maxn], t;
long long c[2 * maxn];
void add(int pos, int val) {
  while (pos <= 2 * n + 10) {
    c[pos] += val;
    pos += pos & (-pos);
  }
}
long long sums(int pos) {
  long long ans = 0;
  while (pos > 0) {
    ans += c[pos];
    pos -= pos & (-pos);
  }
  return ans;
}
int main() {
  while (~scanf("%d%lld", &n, &t)) {
    pre[0] = 0;
    memset(c, 0, sizeof(c));
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &a[i]);
      pre[i] = pre[i - 1] + a[i];
    }
    sort(pre, pre + 1 + n);
    int Size = unique(pre, pre + n + 1) - pre;
    add(lower_bound(pre, pre + 1 + n, 0ll) - pre + 1, 1);
    long long ans = 0, pr = 0;
    for (int i = 1; i <= n; i++) {
      pr += a[i];
      int pos1 = upper_bound(pre, pre + Size, pr - t) - pre;
      ans += (i - sums(pos1));
      int pos2 = lower_bound(pre, pre + Size, pr) - pre + 1;
      add(pos2, 1);
    }
    printf("%lld\n", ans);
  }
  return 0;
}
