#include <bits/stdc++.h>
using namespace std;
int a, b, c, ls, ld, ok, i, j, n, m, maxi, mini, k, first, second;
long long total;
long long dp[1000005], v[1000005];
vector<long long> s;
void upd(int first) {
  for (int i = first; i <= n + 1; i += i & (-i)) v[i]++;
}
long long get(int first) {
  long long rez = 0;
  for (int i = first; i > 0; i -= i & (-i)) rez += v[i];
  return rez;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    cin >> dp[i], dp[i] += dp[i - 1], s.push_back(dp[i]);
  s.push_back(0);
  sort(s.begin(), s.end());
  a = lower_bound(s.begin(), s.end(), 0) - s.begin() + 1;
  upd(a);
  for (int i = 1; i <= n; i++) {
    a = upper_bound(s.begin(), s.end(), dp[i] - m) - s.begin() + 1;
    total += i - get(a - 1);
    a = lower_bound(s.begin(), s.end(), dp[i]) - s.begin() + 1;
    upd(a);
  }
  cout << total;
  return 0;
}
