#include <bits/stdc++.h>
using namespace std;
long long a[200050]{0}, seg[3000005]{0};
vector<long long> v;
void dot(long long b, long long e, long long n, long long i) {
  if (b == e) {
    if (n >= 3000005) {
      while (1) {
      }
    }
    seg[n] += 1;
    return;
  }
  long long mid = (b + e) / 2;
  if (b <= i && i <= mid)
    dot(b, mid, 2 * n, i);
  else
    dot(mid + 1, e, 2 * n + 1, i);
  if (n >= 3000005) {
    while (1) {
    }
  }
  seg[n] = seg[2 * n] + seg[2 * n + 1];
}
long long tell(long long b, long long e, long long n, long long qb,
               long long qe) {
  if (b > qe || e < qb) return 0;
  if (qb <= b && e <= qe) {
    if (n >= 3000005) {
      while (1) {
      }
    }
    return seg[n];
  }
  long long mid = (b + e) / 2;
  long long p = tell(b, mid, 2 * n, qb, qe);
  long long q = tell(mid + 1, e, 2 * n + 1, qb, qe);
  return p + q;
}
int main() {
  long long l = -3e14 - 50;
  long long n, r;
  cin >> n >> r;
  r--;
  v.push_back(0);
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
    v.push_back(a[i]);
  }
  for (long long j = 1; j <= n; j++) {
    v.push_back(a[j] - l);
    v.push_back(a[j] - r);
  }
  sort(v.begin(), v.end());
  long long sz = (long long)(v.size());
  long long y, x = lower_bound(v.begin(), v.end(), 0) - v.begin();
  dot(0, sz, 1, x);
  long long ans = 0;
  for (long long j = 1; j <= n; j++) {
    x = a[j] - r;
    y = a[j] - l;
    x = lower_bound(v.begin(), v.end(), x) - v.begin();
    y = lower_bound(v.begin(), v.end(), y) - v.begin();
    ans += tell(0, sz, 1, x, y);
    x = lower_bound(v.begin(), v.end(), a[j]) - v.begin();
    dot(0, sz, 1, x);
  }
  cout << ans;
  return 0;
}
