#include <bits/stdc++.h>
using namespace std;
int tree[10000010], lson[10000010], rson[10000010], cnt, a[200010], root;
long long sum[200010];
int read() {
  int ans = 0;
  char ch = getchar(), last = '+';
  while (ch < '0' || ch > '9') last = ch, ch = getchar();
  while (ch >= '0' && ch <= '9') {
    ans = ans * 10 + ch - '0';
    ch = getchar();
  }
  if (last == '-') ans = -ans;
  return ans;
}
void insert(long long l, long long r, int &t, long long pos, int key) {
  if (!t) t = ++cnt;
  if (l == r) {
    tree[t] += key;
    return;
  }
  long long mid = (l + r) >> 1;
  if (pos <= mid)
    insert(l, mid, lson[t], pos, key);
  else
    insert(mid + 1, r, rson[t], pos, key);
  tree[t] = tree[lson[t]] + tree[rson[t]];
}
int query(long long l, long long r, int t, long long x, long long y) {
  if (!tree[t]) return 0;
  if (l == x && y == r) return tree[t];
  long long mid = (l + r) >> 1;
  if (y <= mid) return query(l, mid, lson[t], x, y);
  if (x > mid) return query(mid + 1, r, rson[t], x, y);
  return query(l, mid, lson[t], x, mid) +
         query(mid + 1, r, rson[t], mid + 1, y);
}
int main() {
  int n;
  long long t, suml = 0, sumr = 0;
  scanf("%d%lld", &n, &t);
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    if (a[i] > 0)
      sumr += a[i];
    else
      suml += a[i];
  }
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
  insert(suml, sumr, root, 0, 1);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long minl = sum[i] - t + 1;
    if (minl < suml) minl = suml;
    ans += query(suml, sumr, root, minl, sumr);
    insert(suml, sumr, root, sum[i], 1);
  }
  printf("%lld\n", ans);
  return 0;
}
