#include <bits/stdc++.h>
using namespace std;
const int MAX = 5 + 2e5;
int in[MAX], k = 1;
long long s[MAX], sorted[MAX], tos[MAX << 1], BIT[MAX << 1];
map<long long, int> mp;
void add(int i, int val) {
  while (i > 0) {
    BIT[i] += val;
    i -= (i & (-i));
  }
}
long long at_index(int i) {
  long long sum = 0;
  while (i <= k) {
    sum += BIT[i];
    i += (i & (-i));
  }
  return sum;
}
int main() {
  ios::sync_with_stdio(0);
  long long x = 0, t, ans = 0;
  int n, i;
  cin >> n >> t;
  for (i = 0; i < n; ++i) cin >> in[i];
  for (i = 0; i < n; ++i) {
    x += in[i];
    s[i] = x;
    sorted[i] = x;
    tos[i] = x;
  }
  int N = 1 + 2 * n;
  for (i = 0; i < n; ++i) tos[n + i] = t + tos[i];
  tos[n + i] = t;
  sort(sorted, sorted + n);
  sort(tos, tos + N);
  for (i = 0; i < N; ++i) {
    if (mp.find(tos[i]) == mp.end()) {
      mp[tos[i]] = k;
      ++k;
    }
  }
  for (i = 0; i < n; ++i) {
    x = upper_bound(sorted, sorted + n, t - 1) - sorted;
    ans += (x - at_index(mp[t]));
    t += in[i];
    add(k, 1);
    add(mp[s[i]], -1);
  }
  cout << ans;
}
