#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long tree[maxn << 1], a[maxn << 1], t;
int c[maxn << 1], n, cnt;
void add(int x, int v) {
  while (x <= cnt) c[x] += v, x += x & (-x);
}
int get(int r) {
  int sum = 0;
  while (r) sum += c[r], r -= r & (-r);
  return sum;
}
int main() {
  long long x;
  while (~scanf("%d%I64d", &n, &t)) {
    memset(c, 0, sizeof(c));
    memset(a, 0, sizeof(a));
    long long ans = 0;
    tree[0] = 0;
    tree[1] = -t;
    a[0] = 0;
    for (int i = 1; i <= n; ++i) {
      scanf("%I64d", &x);
      a[i] += a[i - 1] + x;
      tree[i * 2] = a[i];
      tree[i * 2 + 1] = a[i] - t;
    }
    sort(tree, tree + n * 2 + 2);
    cnt = unique(tree, tree + 2 * n + 2) - tree;
    int p = lower_bound(tree, tree + cnt, 0) - tree + 1;
    add(p, 1);
    for (int i = 1; i <= n; ++i) {
      x = lower_bound(tree, tree + cnt, a[i] - t) - tree + 1;
      ans += i - get(x);
      x = lower_bound(tree, tree + cnt, a[i]) - tree + 1;
      add(x, 1);
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
