#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;
const long long int mod = 1000000007L;
long long int T, n, i, m, j, k, in, cnt, l;
vector<long long int> a;
vector<long long int>::iterator it;
set<pair<long long int, long long int> > s;
void SORT(vector<long long int> &a) {
  long long int sz = (long long int)a.size();
  if (sz <= 1) return;
  vector<long long int> b, c;
  b.clear();
  b.reserve(sz / 2 + 1);
  c.clear();
  c.reserve(sz - sz / 2 + 1);
  long long int i = 0;
  for (i = 0; i < (sz / 2); ++i) b.push_back(a[i]);
  while (i < sz) {
    c.push_back(a[i]);
    i++;
  }
  SORT(b);
  SORT(c);
  b.push_back(INF);
  c.push_back(INF);
  long long int j = 0, k = 0, l = 0;
  for (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);
  {
    cin >> n >> T;
    a.clear();
    a.reserve(n + 1);
    a.push_back(0);
    for (i = 0; i < (n); ++i) {
      cin >> in;
      a.push_back(a[i] + in);
    }
    SORT(a);
    cout << cnt;
  }
  return 0;
}
