#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f, mod = 1000000007;
const double pi = 3.1415926535897932, eps = 1e-6;
int n;
long long a[200005], pre, suf[200005], pp[200005], d, ans, sum;
map<long long, int> m, num;
int cnt;
struct segtree {
  int dat[1048580], n;
  void build(int nn) {
    n = 1;
    while (n <= nn) n <<= 1;
  }
  void update(int k, int a) {
    k += n - 1;
    dat[k] += a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = dat[(k << 1) + 1] + dat[(k << 1) + 2];
    }
  }
  int query(int l, int r) { return query(l, r + 1, 0, 0, n); }
  int query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return dat[k];
    return query(a, b, (k << 1) + 1, l, (l + r) >> 1) +
           query(a, b, (k << 1) + 2, (l + r) >> 1, r);
  }
} seg;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> d;
  for (int(i) = (1); (i) <= (n); (i)++) cin >> a[i], sum += a[i];
  for (int(i) = (n); (i) >= (1); (i)--) suf[i] = suf[i + 1] + a[i];
  for (int(i) = (1); (i) <= (n + 1); (i)++) m[suf[i]] = 0;
  for (map<long long, int>::iterator it = m.begin(); it != m.end(); it++) {
    it->second = ++cnt;
    pp[cnt] = it->first;
  }
  for (int(i) = (1); (i) <= (n + 1); (i)++) {
    suf[i] = m[suf[i]];
  }
  seg.build(cnt);
  for (int(i) = (1); (i) <= (n + 1); (i)++) seg.update(suf[i], 1);
  for (int(i) = (1); (i) <= (n); (i)++) {
    int pos = upper_bound(pp + 1, pp + cnt + 1, sum - d - pre) - pp;
    seg.update(suf[i], -1);
    ans += seg.query(pos, cnt);
    pre += a[i];
  }
  cout << ans << endl;
  return 0;
}
