#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> v;
struct mstree {
  vector<long long> a;
  vector<vector<long long>> ms;
  mstree(vector<long long> t) {
    a = t;
    ms.resize(4 * t.size() + 30);
    build(0, n - 1, 0);
  }
  void build(long long l, long long r, long long node) {
    if (l == r) {
      ms[node].push_back(a[l]);
      return;
    }
    long long mid = (l + r) / 2;
    build(l, mid, 2 * node + 1);
    build(mid + 1, r, 2 * node + 2);
    long long i = 0, j = 0;
    while (i < ms[2 * node + 1].size() && j < ms[2 * node + 2].size()) {
      if (ms[2 * node + 1][i] <= ms[2 * node + 2][j]) {
        ms[node].push_back(ms[2 * node + 1][i]);
        i += 1;
      } else {
        ms[node].push_back(ms[2 * node + 2][j]);
        j += 1;
      }
    }
    while (i < ms[2 * node + 1].size()) {
      ms[node].push_back(ms[2 * node + 1][i]);
      i++;
    }
    while (j < ms[2 * node + 2].size()) {
      ms[node].push_back(ms[2 * node + 2][j]);
      j++;
    }
    return;
  }
  long long query(long long a, long long b, long long lim, long long l = 0,
                  long long r = n - 1, long long node = 0) {
    if (b < l || a > r) return 0;
    if (l >= a && r <= b) {
      return upper_bound(ms[node].begin(), ms[node].end(), lim) -
             ms[node].begin();
    }
    long long mid = (l + r) / 2;
    long long fir = query(a, b, lim, l, mid, 2 * node + 1);
    long long sec = query(a, b, lim, mid + 1, r, 2 * node + 2);
    return fir + sec;
  }
};
void solve() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  vector<long long> pre(n, 0);
  pre[0] = v[0];
  for (long long i = 1; i < n; i++) pre[i] = pre[i - 1] + v[i];
  mstree tree(pre);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (i == 0) {
      ans += tree.query(i, n - 1, k - 1);
    } else {
      ans += tree.query(i, n - 1, k + pre[i - 1] - 1);
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q = 1;
  while (q--) {
    v.clear();
    solve();
  }
}
