#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
long long tree[maxn * 4], sum[maxn];
long long t;
int a[maxn];
int n;
void Insert(int o, int l, int r, int k, long long v) {
  if (l == r) {
    tree[o] += v;
    return;
  }
  int mid = (l + r) >> 1;
  if (k <= mid)
    Insert(o * 2, l, mid, k, v);
  else
    Insert(o * 2 + 1, mid + 1, r, k, v);
  tree[o] = tree[o * 2] + tree[o * 2 + 1];
}
long long Query(int o, int l, int r, int L, int R) {
  if (L <= l && r <= R) return tree[o];
  long long ans = 0;
  int mid = (l + r) >> 1;
  if (L <= mid) ans += Query(o * 2, l, mid, L, R);
  if (R > mid) ans += Query(o * 2 + 1, mid + 1, r, L, R);
  return ans;
}
set<pair<long long, int> > S;
map<long long, int> H;
vector<long long> V;
int main() {
  cin >> n >> t;
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum[i] += sum[i - 1] + a[i];
    V.push_back(sum[i]);
  }
  sort(V.begin(), V.end());
  int tot = 0;
  S.insert(make_pair(-1e18, -1));
  S.insert(make_pair(1e18, -1));
  for (auto x : V) {
    S.insert(make_pair(x, ++tot));
    H[x] = tot;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (sum[i] < t) ans++;
    long long qq = sum[i] - t;
    auto x = *(S.upper_bound(make_pair(qq, 1e9)));
    if (x.second < 0) {
      Insert(1, 1, n, H[sum[i]], 1);
      continue;
    }
    ans += Query(1, 1, tot, x.second, tot);
    Insert(1, 1, n, H[sum[i]], 1);
  }
  cout << ans << endl;
  return 0;
}
