#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
int ge(const vector<T>& v, T val) {
  return distance(v.begin(), lower_bound(v.begin(), v.end(), val));
}
template <class T>
int gt(const vector<T>& v, T val) {
  return distance(v.begin(), upper_bound(v.begin(), v.end(), val));
}
template <class T>
int le(const vector<T>& v, T val) {
  auto itr = upper_bound(v.begin(), v.end(), val);
  if (itr == v.begin()) return v.size();
  return distance(v.begin(), --itr);
}
template <class T>
int lt(const vector<T>& v, T val) {
  auto itr = lower_bound(v.begin(), v.end(), val);
  if (itr == v.begin()) return v.size();
  return distance(v.begin(), --itr);
}
template <class T>
struct BIT {
  int size;
  vector<T> data;
  function<T(T, T)> f = [](T a, T b) { return a + b; };
  BIT() {}
  BIT(int n) { init(n); }
  void init(int n) {
    size = n;
    data.assign(size + 1, 0);
  }
  T sum(int x) {
    T res = 0;
    while (x > 0) {
      res = f(res, data[x]);
      x -= (x & -x);
    }
    return res;
  }
  T sum(int lft, int rit) {
    if (lft == 0) return sum(rit);
    return sum(rit) - sum(lft - 1);
  }
  void add(int x, T y) {
    while (x <= size) {
      data[x] = f(data[x], y);
      x += (x & -x);
    }
  }
};
int main(void) {
  int n;
  ll t;
  cin >> n >> t;
  vector<ll> a(n + 1, 0), sum(n + 1, 0), v;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  v.assign(sum.begin(), sum.end());
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  int vs = v.size();
  BIT<int> bit(vs + 1);
  ll ans = 0;
  for (int l = n; l >= 0; l--) {
    int i = lt(v, sum[l] + t);
    if (i < vs) {
      ans += bit.sum(i + 1);
    }
    i = ge(v, sum[l]);
    bit.add(i + 1, 1);
  }
  cout << ans << endl;
}
