#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, cnt;
long long t;
int c[N << 2];
long long pre[N];
map<long long, int> mp;
void update(int pos, int val) {
  while (pos <= cnt) {
    c[pos] += val;
    pos += pos & -pos;
  }
  return;
}
int query(int pos) {
  int sum = 0;
  while (pos) {
    sum += c[pos];
    pos -= pos & -pos;
  }
  return sum;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> n >> t;
  int temp;
  for (int i = 1; i <= n; i++) {
    cin >> temp;
    pre[i] = pre[i - 1] + temp;
    mp[pre[i]] = mp[pre[i] - t] = 1;
  }
  mp[0] = 1;
  long long ans = 0;
  for (map<long long, int>::iterator it = mp.begin(); it != mp.end(); it++)
    it->second = ++cnt;
  update(mp[0], 1);
  for (int i = 1; i <= n; i++) {
    ans += i - query(mp[pre[i] - t]);
    update(mp[pre[i]], 1);
  }
  cout << ans;
  return 0;
}
