#include <bits/stdc++.h>
using namespace std;
int n;
long long BIT[200005] = {0};
long long t, x, p[200005];
void update(int x) {
  for (; x >= 0; x = (x & (x + 1)) - 1) BIT[x]++;
}
long long get(int x) {
  long long res = 0;
  for (; x <= 200001; x = x | (x + 1)) res += BIT[x];
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> t;
  for (int i = 0, x; i < n; i++)
    cin >> x, (i != 0 ? p[i] = p[i - 1] + x : p[i] = x);
  vector<long long> c;
  for (int i = 0; i < n; i++) c.push_back(p[i]);
  sort(c.begin(), c.end());
  long long res = 0;
  for (int i = 0; i < n; i++) {
    int x = lower_bound(c.begin(), c.end(), p[i] - t + 1ll) - c.begin() + 1;
    res += get(x);
    if (p[i] < t) res++;
    int y = lower_bound(c.begin(), c.end(), p[i]) - c.begin() + 1;
    update(y);
  }
  cout << res;
  return 0;
}
