#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n, acjlksdfjlqwekrfhjasdfnv, a[N], b[N];
long long t, lajiksdfhfuklasdklfjasdlkxxzcvadfs[N], cqtnasftladskjfnlas[N],
    Apojacsleam_fuck_codeforces_fuck_hack;
void qwepoipriewpoqr(int wz) {
  for (int i = wz; i <= cqtnasftladskjfnlas[0]; i += ((i) & (-(i)))) ++b[i];
}
int vnmzxcnvmnmx(int wz) {
  int re = 0;
  for (int i = wz; i; i -= ((i) & (-(i)))) re += b[i];
  return re;
}
int main() {
  scanf("%d", &n);
  cin >> t;
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[i]),
        cqtnasftladskjfnlas[++cqtnasftladskjfnlas[0]] =
            lajiksdfhfuklasdklfjasdlkxxzcvadfs[i] =
                lajiksdfhfuklasdklfjasdlkxxzcvadfs[i - 1] + a[i];
  cqtnasftladskjfnlas[++cqtnasftladskjfnlas[0]] = 0;
  sort(cqtnasftladskjfnlas + 1,
       cqtnasftladskjfnlas + cqtnasftladskjfnlas[0] + 1);
  cqtnasftladskjfnlas[0] =
      unique(cqtnasftladskjfnlas + 1,
             cqtnasftladskjfnlas + cqtnasftladskjfnlas[0] + 1) -
      cqtnasftladskjfnlas - 1;
  for (int i = 1; i <= cqtnasftladskjfnlas[0]; i++)
    if (!cqtnasftladskjfnlas[i]) acjlksdfjlqwekrfhjasdfnv = i;
  qwepoipriewpoqr(acjlksdfjlqwekrfhjasdfnv);
  for (int i = 1; i <= n; i++)
    lajiksdfhfuklasdklfjasdlkxxzcvadfs[i] =
        lower_bound(cqtnasftladskjfnlas + 1,
                    cqtnasftladskjfnlas + cqtnasftladskjfnlas[0] + 1,
                    lajiksdfhfuklasdklfjasdlkxxzcvadfs[i]) -
        cqtnasftladskjfnlas;
  for (int i = 1; i <= n; i++) {
    long long tmp =
        upper_bound(
            cqtnasftladskjfnlas + 1,
            cqtnasftladskjfnlas + cqtnasftladskjfnlas[0] + 1,
            cqtnasftladskjfnlas[lajiksdfhfuklasdklfjasdlkxxzcvadfs[i]] - t) -
        (cqtnasftladskjfnlas + 1);
    Apojacsleam_fuck_codeforces_fuck_hack += i - vnmzxcnvmnmx(tmp);
    qwepoipriewpoqr(lajiksdfhfuklasdklfjasdlkxxzcvadfs[i]);
  }
  printf("%I64d", Apojacsleam_fuck_codeforces_fuck_hack);
  return 0;
}
