#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 6;
const int N = 5e3 + 5;
const int mod = 998244353;
map<pair<int, int>, int> mp;
map<pair<int, int>, int>::iterator it;
long long n, a[maxn * 3], c[maxn * 3], b[maxn * 3], sum[maxn * 3];
void add(int x, long long val) {
  for (; x < maxn; x += x & (-x)) c[x] += val;
}
long long ask(long long x) {
  long long res = 0;
  while (x) {
    res += c[x];
    x -= x & (-x);
  }
  return res;
}
int main() {
  long long t;
  scanf("%lld%lld", &n, &t);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    sum[i] = sum[i - 1] + a[i];
    b[i] = sum[i];
  }
  sort(b, b + 1 + n);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long suml = sum[i] - t + 1;
    add(lower_bound(b, b + 1 + n, sum[i - 1]) - b + 1, 1);
    ans = ans + i - ask(lower_bound(b, b + 1 + n, suml) - b);
  }
  printf("%lld\n", ans);
}
