#include <bits/stdc++.h>
using namespace std;
const int DN = 2e5 + 5;
int st, dr, mij;
long long n, t, a[DN], s[DN], r[DN], c[DN], val, rez;
pair<long long, int> b[DN];
void update(int poz) {
  while (poz <= n) {
    r[poz]++;
    poz += (poz & (-poz));
  }
}
int query(int poz) {
  int rez = 0;
  while (poz > 0) {
    rez += r[poz];
    poz -= (poz & (-poz));
  }
  return rez;
}
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  cin >> n >> t;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s[i] = s[i - 1] + a[i];
    b[i].first = s[i];
    b[i].second = i;
  }
  sort(b + 1, b + n + 1);
  for (int i = 1; i <= n; i++) c[b[i].second] = i;
  for (int i = 1; i <= n; i++) {
    if (s[i] < t) rez++;
    {
      val = s[i] - t + 1;
      st = 1;
      dr = n;
      while (st < dr) {
        mij = (st + dr) / 2;
        if (b[mij].first >= val)
          dr = mij;
        else
          st = mij + 1;
      }
      if (b[st].first >= val) rez += query(n) - query(st - 1);
    }
    update(c[i]);
  }
  cout << rez;
}
