#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long sum[N], n, t;
long long ans;
void f(int l, int r) {
  if (l >= r) return;
  int mid = (l + r) >> 1;
  f(l, mid);
  f(mid + 1, r);
  long long cnt = 0;
  int j = mid + 1;
  for (int i = l; i <= mid; ++i) {
    while (j <= r and sum[j] - sum[i] < t) ++j;
    cnt += (j - 1) - mid;
  }
  ans += cnt;
  inplace_merge(sum + l, sum + mid + 1, sum + r + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> t;
  for (int i = 1; i <= n; ++i) {
    cin >> sum[i];
    sum[i] += sum[i - 1];
  }
  f(0, n);
  cout << ans << '\n';
}
