#include <bits/stdc++.h>
using namespace std;
void insert(long long tl, long long tr, long long val, long long index,
            long long segTree[]) {
  if (tl == tr) {
    segTree[index]++;
    return;
  }
  long long mid = (tl + tr) / 2;
  if (val <= mid)
    insert(tl, mid, val, 2 * index + 1, segTree);
  else
    insert(mid + 1, tr, val, 2 * index + 2, segTree);
  segTree[index] = segTree[2 * index + 1] + segTree[2 * index + 2];
}
long long query(long long tl, long long tr, long long l, long long r,
                long long index, long long segTree[]) {
  if (l > r) return 0;
  if (tl == l && tr == r) return segTree[index];
  long long mid = (tl + tr) / 2;
  return query(tl, mid, l, min(r, mid), 2 * index + 1, segTree) +
         query(mid + 1, tr, max(l, mid + 1), r, 2 * index + 2, segTree);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, t;
  cin >> n >> t;
  long long a[n + 1];
  a[0] = 0;
  for (long long i = 1; i <= n; i++) cin >> a[i], a[i] += a[i - 1];
  set<long long> sorted;
  for (long long i = 0; i <= n; i++) sorted.insert(a[i]);
  std::vector<long long> v;
  for (auto itr = sorted.begin(); itr != sorted.end(); itr++) v.push_back(*itr);
  long long segTree[4 * v.size() - 1];
  memset(segTree, 0, sizeof(segTree));
  unordered_map<long long, long long> mapping;
  for (long long i = 0; i < v.size(); i++) mapping[v[i]] = i;
  insert(0, v.size() - 1, mapping[0], 0, segTree);
  long long ans = 0, val = 0;
  for (long long i = 1; i <= n; i++) {
    val = a[i] - t;
    auto itr = upper_bound(v.begin(), v.end(), val);
    if (itr == v.end()) {
      insert(0, v.size() - 1, mapping[a[i]], 0, segTree);
      continue;
    }
    ans += query(0, v.size() - 1, mapping[*itr], v.size() - 1, 0, segTree);
    insert(0, v.size() - 1, mapping[a[i]], 0, segTree);
  }
  cout << ans;
  return 0;
}
