#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, t;
  cin >> n >> t;
  vector<long long> tree[2 * n];
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    tree[i + n].push_back(x);
  }
  for (long long i = 1; i < n; i++) tree[i + n][0] += tree[i + n - 1][0];
  for (long long i = n - 1; i > 0; i--) {
    long long lc = (i << 1), rc = (i << 1 | 1);
    merge(tree[lc].begin(), tree[lc].end(), tree[rc].begin(), tree[rc].end(),
          back_inserter(tree[i]));
  }
  long long ad = 0, cnt = 0;
  for (long long i = 0; i < n; i++) {
    long long ser = ad + t;
    long long l = i, r = n;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) {
        cnt +=
            lower_bound(tree[l].begin(), tree[l].end(), ser) - tree[l].begin();
        l++;
      }
      if (r & 1) {
        --r;
        cnt +=
            lower_bound(tree[r].begin(), tree[r].end(), ser) - tree[r].begin();
      }
    }
    if (i)
      ad += tree[i + n][0] - tree[i + n - 1][0];
    else
      ad += tree[i + n][0];
  }
  cout << cnt << '\n';
  return 0;
}
