#include <bits/stdc++.h>
using namespace std;
long long n, T, cnt, a[200005], pre[200005];
void solve(long long l, long long r) {
  if (l < r) {
    long long mid = (l + r) >> 1;
    solve(l, mid);
    solve(mid + 1, r);
    long long j = mid + 1;
    for (long long i = l; i <= mid; ++i) {
      while (j <= r && pre[j] - pre[i] < T) ++j;
      cnt += j - mid - 1;
    }
    sort(pre + l, pre + r + 1);
  }
}
signed main() {
  scanf("%lld%lld", &n, &T);
  for (long long i = 1; i <= n; ++i)
    scanf("%lld", &a[i]), pre[i] = pre[i - 1] + a[i];
  solve(0, n);
  printf("%lld", cnt);
  return 0;
}
