#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
long long c[maxn], a[maxn], b[maxn];
int n;
int lowbit(int x) { return x & -x; }
void add(int x, long long val) {
  while (x <= n + 1) {
    c[x] += val;
    x += lowbit(x);
  }
}
long long query(int x) {
  long long ans = 0;
  while (x) {
    ans += c[x];
    x -= lowbit(x);
  }
  return ans;
}
int main() {
  long long t;
  scanf("%d%lld", &n, &t);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    a[i] += a[i - 1];
    b[i] = a[i];
  }
  sort(b, b + 1 + n);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    add(lower_bound(b, b + 1 + n, a[i - 1]) - b + 1, 1LL);
    ans += (long long)(i - query(upper_bound(b, b + 1 + n, a[i] - t) - b));
  }
  printf("%lld\n", ans);
  return 0;
}
