#include <bits/stdc++.h>
using namespace std;
long long n, t, p;
long long tree[200007];
long long k[200007], a[200007];
void add(long long x) {
  for (long long i = x; i < n + 2; i += i & -i) tree[i]++;
}
long long sum(long long x) {
  long long res = 0;
  for (long long i = x; i > 0; i -= i & -i) res += tree[i];
  return res;
}
int main() {
  cin >> n >> t;
  k[1] = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    p += a[i];
    k[i + 1] = p;
  }
  sort(k + 1, k + 1 + n);
  long long res = 0, p = 0;
  int ps;
  for (int i = 1; i <= n; ++i) {
    ps = lower_bound(k + 1, k + 1 + n, p) - k;
    add(ps);
    p += a[i];
    ps = upper_bound(k + 1, k + 1 + n, p - t) - k - 1;
    res += i - sum(ps);
  }
  cout << res << endl;
  return 0;
}
