#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const long long MOD = 1e9 + 7, SIZE = 1e5 * 2 + 10, P = 10000, P2 = 100000,
                MOD2 = 1e9 + 3, INF = 998244353 * 1e6;
vector<long long> vec;
long long n, t;
long long solve(int l, int r) {
  if (l == r) {
    return (vec[l] <= t);
  }
  if (l == r - 1) {
    return (vec[l] <= t) + (vec[r] <= t) + (vec[r] + vec[l] <= t);
  }
  int mid = (l + r) / 2;
  long long ret = solve(l, mid) + solve(mid + 1, r);
  vector<long long> suf1;
  suf1.push_back(0);
  for (int i = mid; i >= l; i--) {
    suf1.push_back(suf1.back() + vec[i]);
  }
  suf1.erase(suf1.begin());
  sort(suf1.begin(), suf1.end());
  long long s = 0;
  for (int i = mid + 1; i <= r; i++) {
    s += vec[i];
    int l2 = -1, r2 = suf1.size();
    while (r2 - l2 > 1) {
      int mid = (l2 + r2) / 2;
      if (suf1[mid] <= t - s) {
        l2 = mid;
      } else {
        r2 = mid;
      }
    }
    ret += l2 + 1;
  }
  return ret;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  cin >> n >> t;
  t--;
  vec.resize(n);
  for (int i = 0; i < n; i++) cin >> vec[i];
  cout << solve(0, vec.size() - 1);
  return 0;
}
