#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
const long long inf = 2e18;
long long a[N];
long long n, t;
long long ans = 0;
void merge(long long l, long long mid, long long r) {
  long long b1[n + 1];
  long long b2[n + 1];
  long long x = 0;
  for (long long i = l; i <= mid; i++) {
    b1[x] = a[i];
    x++;
  }
  b1[x] = inf;
  x = 0;
  for (long long i = mid + 1; i <= r; i++) {
    b2[x] = a[i];
    x++;
  }
  b2[x] = inf;
  long long i = 0, j = 0;
  for (long long k = l; k <= r; k++) {
    if (b1[i] <= b2[j])
      a[k] = b1[i++];
    else
      a[k] = b2[j++];
  }
}
void solve(long long left, long long right) {
  if (left == right) {
    return;
  }
  long long mid = (left + right) / 2;
  solve(left, mid);
  solve(mid + 1, right);
  long long temp[n];
  long long x = 0;
  for (long long i = left; i <= mid; i++) {
    temp[x] = a[i];
    x++;
  }
  for (long long i = mid + 1; i <= right; i++) {
    long long tt = upper_bound(temp, temp + (x), a[i] - t) - temp;
    tt = (x)-tt;
    ans += (tt);
  }
  merge(left, mid, right);
}
signed main() {
  cin >> n >> t;
  a[0] = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
    if (a[i] < t) ans++;
  }
  solve(1, n);
  cout << ans << '\n';
}
