#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("avx2")
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int RANDOM =
    chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash {
  int operator()(int x) const { return x ^ RANDOM; }
};
const int mod = 1e9 + 7;
const int mxN = 2e5 + 5;
struct node {
  long long val, left, right;
  node() { val = left = right = 0; }
};
const int mxNodes = 25 * mxN;
vector<node> nodes(mxNodes);
int counter = 0;
class DynPersistentSegTree {
 public:
  int start_root;
  vector<int> roots;
  long long n;
  DynPersistentSegTree() {
    start_root = 0;
    roots.push_back(start_root);
  }
  ~DynPersistentSegTree() {}
  int inline getRoot() { return roots.back(); }
  void update(long long curr, long long nxtV, long long l, long long r,
              long long idx, long long diff) {
    if (l == r) {
      nodes[nxtV].val = nodes[curr].val + diff;
      return;
    }
    long long mid = l + ((r - l) >> 1);
    if (l <= idx && idx <= mid) {
      nodes[nxtV].left = ++counter;
      nodes[nxtV].right = nodes[curr].right;
      update(nodes[curr].left, nodes[nxtV].left, l, mid, idx, diff);
    }
    if (mid + 1 <= idx && idx <= r) {
      nodes[nxtV].right = ++counter;
      nodes[nxtV].left = nodes[curr].left;
      update(nodes[curr].right, nodes[nxtV].right, mid + 1, r, idx, diff);
    }
    nodes[nxtV].val =
        nodes[nodes[nxtV].left].val + nodes[nodes[nxtV].right].val;
  }
  void inline upd(long long idx, long long diff) {
    int latest_root = roots.back();
    int new_Version_root = ++counter;
    update(latest_root, new_Version_root, 0, n - 1, idx, diff);
    roots.push_back(new_Version_root);
  }
  long long query(long long curr, long long l, long long r, long long L,
                  long long R) {
    if (!curr) return 0;
    if (L <= l && r <= R) {
      return nodes[curr].val;
    }
    long long mid = l + ((r - l) >> 1);
    return (!(mid < L || R < l) ? query(nodes[curr].left, l, mid, L, R) : 0) +
           (!(r < L || R < mid + 1) ? query(nodes[curr].right, mid + 1, r, L, R)
                                    : 0);
  }
  long long inline qry(long long groot, long long L, long long R) {
    return query(groot, 0, n - 1, L, R);
  }
  int mquery(int curr, int l, int r, int upto) {
    if (l == r) {
      return r;
    }
    int mid = l + ((r - l) >> 1);
    if (nodes[nodes[curr].left].val < upto) {
      return mquery(nodes[curr].right, mid + 1, r,
                    upto - nodes[nodes[curr].left].val);
    } else {
      return mquery(nodes[curr].left, l, mid, upto);
    }
  }
  int getIdx(int groot, int k) { return 1 + mquery(groot, 0, n - 1, k); }
};
void solve(int tt) {
  long long cnt = 0, sum = 0, n, t;
  cin >> n >> t;
  vector<long long> pref(n);
  map<long long, int> hmp;
  hmp[0] = 1;
  for (long long& x : pref) {
    cin >> x;
    sum += x;
    x = sum;
    hmp[sum] = 1;
    hmp[sum - t] = 1;
  }
  DynPersistentSegTree seg;
  seg.n = hmp.size();
  int ptr = 0;
  for (auto& it : hmp) {
    it.second = ptr++;
  }
  seg.upd(hmp[0], 1);
  ptr = 1;
  for (long long& sum : pref) {
    cnt += (ptr++) - seg.qry(seg.roots.back(), 0, hmp[sum - t]);
    seg.upd(hmp[sum], 1);
  }
  cout << cnt << "\n";
}
int main() {
  int tt = 0, t = 1;
  while (t--) {
    solve(++tt);
  }
  cerr << "processor time: " << clock() / (double)CLOCKS_PER_SEC << "s    ";
  return 0;
}
