#include <bits/stdc++.h>
using namespace std;
struct data {
  long long sum;
  int id;
} SUM[400005];
int Tree[1600005], L, R, Pos;
int a, n, ID[400005];
long long t;
long long Ans;
int Query(int o, int l, int r) {
  if (l > R || r < L) return 0;
  if (l >= L && r <= R) return Tree[o];
  return Query(o << 1, l, (l + r) >> 1) +
         Query(o << 1 | 1, ((l + r) >> 1) + 1, r);
}
void Update(int o, int l, int r) {
  if (l > Pos || r < Pos) return;
  if (l == r) {
    Tree[o]++;
    return;
  }
  Update(o << 1, l, (l + r) >> 1);
  Update(o << 1 | 1, ((l + r) >> 1) + 1, r);
  Tree[o] = Tree[o << 1] + Tree[o << 1 | 1];
}
bool cmp(data fi, data se) { return fi.sum < se.sum; }
int main() {
  scanf("%d%lld", &n, &t);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    SUM[i].sum = SUM[i - 1].sum + (long long)a;
    if (SUM[i].sum < t) Ans++;
    SUM[i].id = i;
    SUM[i + n].id = i + n;
    SUM[i + n].sum = SUM[i].sum - t;
  }
  sort(SUM + 1, SUM + (n << 1) + 1, cmp);
  ID[SUM[1].id] = 1;
  for (int i = 2; i <= (n << 1); i++)
    if (SUM[i].sum == SUM[i - 1].sum)
      ID[SUM[i].id] = ID[SUM[i - 1].id];
    else
      ID[SUM[i].id] = ID[SUM[i - 1].id] + 1;
  for (int i = 1; i <= n; i++) {
    L = 1;
    R = ID[i + n];
    if (i > 1) Ans += (long long)(i - 1 - Query(1, 1, (n << 1)));
    Pos = ID[i];
    Update(1, 1, (n << 1));
  }
  printf("%lld", Ans);
  return 0;
}
