#include <bits/stdc++.h>
using namespace std;
struct suma {
  long long val;
  long long id;
};
bool operator<(const suma& l, const suma& r) {
  if (l.val == r.val) return l.id < r.id;
  return l.val < r.val;
}
long long mas[200006];
long long yee[200006] = {};
long long dar[200006];
struct node {
  long long a, b;
  long long geri;
  long long minas, maksas;
  node* left;
  node* right;
  void sugadink(long long ka) {
    if (ka >= minas && ka <= maksas) {
      if (left != 0) {
        left->sugadink(ka);
        right->sugadink(ka);
      }
      --geri;
    }
  }
  long long kiekGeru(long long iki) {
    if (maksas <= iki) return geri;
    if (minas > iki) return 0;
    return left->kiekGeru(iki) + right->kiekGeru(iki);
  }
  void print() {
    if (left == 0)
      cout << maksas << " ";
    else {
      right->print();
      left->print();
    }
  }
  node(long long x, long long y) {
    a = x;
    b = y;
    geri = b - a + 1;
    left = 0;
    right = 0;
    if (a == b) {
      minas = dar[a];
      maksas = dar[a];
    } else {
      left = new node(x, (x + y) / 2);
      right = new node((x + y) / 2 + 1, y);
      maksas = max(left->maksas, right->maksas);
      minas = min(left->minas, right->minas);
    }
  }
};
int main() {
  long long n, t;
  cin >> n >> t;
  for (long long i = 0; i < n; ++i) {
    cin >> mas[i];
  }
  yee[n - 1] = mas[n - 1];
  dar[n - 1] = mas[n - 1];
  for (long long i = 1; i < n; ++i) {
    yee[n - i - 1] = yee[n - i] + mas[n - 1 - i];
    dar[n - 1 - i] = yee[n - 1 - i];
  }
  sort(dar, dar + n);
  node medis(0, n - 1);
  long long ans = 0;
  long long subSum = 0;
  for (long long i = n - 1; i >= 0; --i) {
    ans += medis.kiekGeru(t + subSum - 1);
    medis.sugadink(yee[i]);
    subSum += mas[i];
  }
  cout << ans;
  return 0;
}
