#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool f = 0;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = 1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return f ? -x : x;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  putchar('\n');
}
void writep(long long x) {
  write(x);
  putchar(' ');
}
long long const N = 4e5 + 3;
long long n, t, ans, tot, a[N], sum[N], tr[N];
void add(long long x, long long v) {
  for (; x <= tot; x += x & -x) tr[x] += v;
}
long long ask(long long x) {
  long long res = 0;
  for (; x; x -= x & -x) res += tr[x];
  return res;
}
signed main() {
  n = read();
  t = read();
  for (long long i = 1; i <= n; i++) sum[i] = sum[i - 1] + read();
  for (long long i = 1; i <= n; i++) a[++tot] = sum[i], a[++tot] = sum[i] - t;
  a[++tot] = 0;
  sort(a + 1, a + tot + 1);
  tot = unique(a + 1, a + tot + 1) - a - 1;
  add(lower_bound(a + 1, a + tot + 1, 0) - a, 1);
  for (long long i = 1; i <= n; i++) {
    ans += i - ask(lower_bound(a + 1, a + tot + 1, sum[i] - t) - a);
    add(lower_bound(a + 1, a + tot + 1, sum[i]) - a, 1);
  }
  writeln(ans);
  return 0;
}
