#include <bits/stdc++.h>
using namespace std;
inline void prep() {
  cin.tie(0);
  cin.sync_with_stdio(0);
};
const int mod = (int)1e9 + 7;
const int MX = (int)2e5 + 10;
long long a[MX];
vector<long long> tree[4 * MX];
void build(int node, int l, int r) {
  if (l == r) {
    return tree[node].push_back(a[l]);
  }
  int mid = (l + r) / 2;
  build(node * 2, l, mid);
  build(node * 2 + 1, mid + 1, r);
  merge(tree[node * 2].begin(), tree[node * 2].end(),
        tree[node * 2 + 1].begin(), tree[node * 2 + 1].end(),
        back_inserter(tree[node]));
  return;
}
int query(int node, int l, int r, int e, long long val) {
  if (l > r || e < l) return 0;
  if (r <= e) {
    auto it = tree[node].end() -
              lower_bound(tree[node].begin(), tree[node].end(), val);
    return it;
  }
  int mid = (l + r) / 2;
  int res = query(node * 2, l, mid, e, val);
  res += query(node * 2 + 1, mid + 1, r, e, val);
  return res;
}
int main() {
  prep();
  int n;
  long long k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  partial_sum(a, a + n + 1, a);
  build(1, 0, n);
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    int here = query(1, 0, n, i - 1, a[i] - k + 1);
    res += here;
  }
  cout << res << '\n';
  return 0;
}
