#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 1;
const long long maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
long long a[maxn], n, t, c[maxn];
long long solve(long long l, long long r) {
  if (l == r - 1) {
    if (a[l] < t) {
      return 1;
    }
    return 0;
  }
  if (l == r - 2) {
    long long ff = 0;
    if (a[l] < t) ff++;
    if (a[l + 1] < t) ff++;
    if (a[l] + a[l + 1] < t) ff++;
    return ff;
  }
  vector<long long> v1, v2;
  long long mid = (l + r) / 2;
  v1.push_back(a[mid - 1]);
  for (long long i = mid - 2; i >= l; i--) {
    v1.push_back(v1[v1.size() - 1] + a[i]);
  }
  v2.push_back(a[mid]);
  for (long long i = mid + 1; i < r; i++) {
    v2.push_back(v2[v2.size() - 1] + a[i]);
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  reverse(v1.begin(), v1.end());
  long long ret = 0;
  long long j = 0;
  for (long long i = 0; i < v1.size(); i++) {
    while (true) {
      if (j == v2.size()) break;
      if (v2[j] + v1[i] < t)
        j++;
      else
        break;
    }
    ret += j;
  }
  return ret + solve(l, mid) + solve(mid, r);
}
int32_t main() {
  scanf("%lld%lld", &n, &t);
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  cout << solve(0, n) << endl;
  return 0;
}
