#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
inline int input() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
long long fen[maxn];
long long a[maxn];
inline void add(long long p, long long val) {
  p += 5;
  for (; p < maxn; p += p & -p) fen[p] += val;
}
inline long long get(long long p) {
  p += 5;
  long long ret = 0;
  for (; p > 0; p -= p & -p) ret += fen[p];
  return ret;
}
long long b[maxn];
int32_t main() {
  long long n, t;
  cin >> n >> t;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    a[i] = input();
    sum += a[i];
    b[i] = sum;
  }
  sort(b, b + n);
  sum = 0;
  long long res = 0;
  for (long long i = 0; i < n; i++) {
    sum += a[i];
    long long where = lower_bound(b, b + n, sum) - b;
    long long where2 = upper_bound(b, b + n, sum - t) - b - 1;
    res += i - get(where2);
    add(where, 1);
    if (sum < t) res++;
  }
  cout << res << endl;
}
