#include <bits/stdc++.h>
using namespace std;
template <class T>
using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
template <class T>
struct FenwickTree {
  vector<T> node;
  FenwickTree(int n) : node(n, 0) {}
  void add(int idx, T val) {
    for (int i = idx; i < node.size(); i |= i + 1) {
      node[i] += val;
    }
  }
  void update(int idx, T val) {
    add(idx, -sum(idx, idx + 1));
    add(idx, val);
  }
  T sum(int idx) {
    T ret = 0;
    for (int i = idx - 1; i >= 0; i = (i & (i + 1)) - 1) {
      ret += node[i];
    }
    return ret;
  }
  T sum(int l, int r) { return sum(r) - sum(l); }
};
int main() {
  long long N, K;
  cin >> N >> K;
  vector<long long> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  vector<long long> acc(N, 0);
  for (int i = 0; i < N; i++) {
    if (i == 0)
      acc[i] = a[i];
    else
      acc[i] = acc[i - 1] + a[i];
  }
  map<long long, long long> trans;
  for (int i = 0; i < acc.size(); i++) trans[acc[i]] = 0;
  int cnt = 0;
  for (auto &x : trans) x.second = cnt++;
  vector<long long> cnd;
  for (auto &x : trans) cnd.push_back(x.first);
  sort(cnd.begin(), cnd.end());
  FenwickTree<long long> inst(100010);
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    if (i == 0) {
      if (acc[i] >= K) ans++;
    } else {
      if (acc[i] - acc[0] >= K) {
        int l = 0, r = i;
        while (r - l > 1) {
          int mid = (l + r) / 2;
          if (acc[i] - cnd[mid] >= K) {
            l = mid;
          } else {
            r = mid;
          }
        }
        ans += inst.sum(0, l + 1);
      }
      if (acc[i] >= K) {
        ans++;
      }
    }
    inst.add(trans[acc[i]], 1LL);
  }
  cout << ans << endl;
  return 0;
}
