#include <bits/stdc++.h>
using namespace std;
const long long N = 400000 + 77;
const long long NN = 2e18;
long long n;
long long t, a[N], fen[N], A, ps[N];
vector<long long> V;
inline long long GetId(long long x) {
  return lower_bound(V.begin(), V.end(), x) - V.begin() + 1;
}
void Add(long long x, long long val) {
  for (; x < N; x += x & -x) {
    fen[x] += val;
  }
}
long long Get(long long x) {
  long long ans = 0;
  for (; x; x -= x & -x) {
    ans += fen[x];
  }
  return ans;
}
long long Get(long long l, long long r) {
  return Get(r) - Get(max(0ll, l - 1));
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> t;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    ps[i] = ps[i - 1] + a[i];
  }
  for (long long i = 1; i <= n; i++) {
    V.push_back(ps[i]);
    V.push_back(ps[i] - t + 1);
  }
  V.push_back(0);
  sort(V.begin(), V.end());
  V.resize(unique(V.begin(), V.end()) - V.begin());
  Add(GetId(0), 1);
  for (long long i = 1; i <= n; i++) {
    A += Get(GetId(ps[i] - t + 1), N - 1);
    Add(GetId(ps[i]), 1);
  }
  cout << A;
  return 0;
}
