#include <bits/stdc++.h>
using namespace std;
long long n, t;
long long solve(vector<long long> cis) {
  if (cis.size() == 0) return 0;
  if (cis.size() == 1) return cis[0] < t ? 1 : 0;
  if (cis.size() == 2) {
    return (cis[0] < t ? 1 : 0) + (cis[0] + cis[1] < t ? 1 : 0) +
           (cis[1] < t ? 1 : 0);
  }
  vector<long long> le, ri;
  long long mid = cis.size() / 2;
  vector<long long> ple, pri;
  long long ss = 0, ssb = 0;
  for (long long(a) = 0; (a) < (cis.size()); (a)++) {
    if (a < mid) le.push_back(cis[a]);
    if (a > mid) ri.push_back(cis[a]);
    ss += cis[a];
    if (a >= mid) pri.push_back(ss);
  }
  for (int a = cis.size() - 1; a >= 0; a--) {
    ssb += cis[a];
    if (a <= mid) ple.push_back(ssb);
  }
  sort(pri.begin(), pri.end());
  sort(ple.begin(), ple.end());
  long long i = 0, j = pri.size() - 1;
  long long sol = 0;
  while (i < ple.size() && j >= 0) {
    while (ple[i] + pri[j] >= t + ss && j >= 0) j--;
    if (ple[i] + pri[j] < t + ss && j >= 0) {
      sol += j + 1;
    }
    i++;
  }
  long long left = solve(le);
  long long right = solve(ri);
  return sol + left + right;
}
int main() {
  cin >> n >> t;
  vector<long long> cis;
  for (long long(a) = 0; (a) < (n); (a)++) {
    long long pr;
    cin >> pr;
    cis.push_back(pr);
  }
  printf("%lli\n", solve(cis));
  return 0;
}
