#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("-ffloat-store")
using namespace std;
const long long int INF = 0xFFFFFFFFFFFFFL;
long long int cnt, T;
void SORT(long long int *a, int sz) {
  if (sz <= 1) return;
  long long int b[sz / 2 + 2], c[sz / 2 + 2];
  long long int i = 0;
  for (i = 0; i < (sz / 2); ++i) b[i] = a[i];
  while (i < sz) {
    c[i - sz / 2] = a[i];
    i++;
  }
  SORT(b, sz / 2);
  SORT(c, sz - sz / 2);
  b[sz / 2] = c[sz - sz / 2] = INF;
  long long int j = 0, k = 0, l = 0;
  for (int i = 0; i < sz; ++i) {
    if (b[j] <= c[k])
      a[i] = b[j++];
    else {
      while (l < sz / 2 && c[k] >= b[l] + T) l++;
      cnt += sz / 2 - l;
      a[i] = c[k++];
    }
  }
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    int n;
    cin >> n >> T;
    long long int a[n + 2];
    a[0] = 0;
    for (int i = 0; i < n; ++i) {
      cin >> a[i + 1];
      a[i + 1] += a[i];
    }
    SORT(a, n + 1);
    cout << cnt;
  }
  return 0;
}
