#include <bits/stdc++.h>
using namespace std;
long n, f[200005];
long long T;
pair<long long, long> s[200005];
void update(long i) {
  for (; i <= n + 1; i += i & (-i)) f[i]++;
}
long get(long i) {
  long r = 0;
  for (; i >= 1; i -= i & (-i)) r += f[i];
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> T;
  for (long i = 1; i <= n; i++) {
    cin >> s[i + 1].first;
    s[i + 1].first += s[i].first;
    s[i + 1].second = i + 1;
  }
  s[1] = pair<long long, long>(0, 1);
  sort(s + 1, s + n + 2);
  long j = n + 1;
  long long res = 0;
  for (long i = n + 1; i >= 1; i--) {
    while (j >= 1 && s[j].first > s[i].first - T) {
      update(s[j].second);
      j--;
    }
    res += get(s[i].second - 1);
  }
  cout << res;
  return 0;
}
