#include <bits/stdc++.h>
using namespace std;
int n, c[200011];
long long t, a[200001];
vector<long long> v;
int query(int x) {
  int ans = 0;
  for (int i = x; i <= 200010; i += i & -i) ans += c[i];
  return ans;
}
void add(int x, int p) {
  for (int i = x; i; i -= i & -i) c[i] += p;
}
int main() {
  scanf("%d%lld", &n, &t);
  v.push_back(0);
  for (int i = 1; i <= n; ++i)
    scanf("%lld", &a[i]), a[i] += a[i - 1], v.push_back(a[i]);
  long long ans = 0;
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  add(lower_bound(v.begin(), v.end(), 0) - v.begin() + 1, 1);
  for (int i = 1; i <= n; ++i) {
    ans += query(upper_bound(v.begin(), v.end(), a[i] - t) - v.begin() + 1);
    add(lower_bound(v.begin(), v.end(), a[i]) - v.begin() + 1, 1);
  }
  printf("%lld\n", ans);
  return 0;
}
