#include <bits/stdc++.h>
using namespace std;
vector<long long int> bit(400005, 0), pre(400005, 0);
map<long long int, long long int> mp;
void upd(int x) {
  while (x < 400005) {
    bit[x]++;
    x += x & -x;
  }
}
int get(int x) {
  int ans = 0;
  while (x > 0) {
    ans += bit[x];
    x -= x & -x;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t, n, m, q, i, j, k, x, y, z;
  long long int ans = 0;
  cin >> n >> k;
  mp[0] = 1;
  mp[-k] = 1;
  for (i = 1; i <= n; i++) {
    cin >> x;
    pre[i] = pre[i - 1] + x;
    mp[pre[i]] = 1;
    mp[pre[i] - k] = 1;
  }
  long long int ind = 0;
  for (auto it = mp.begin(); it != mp.end(); it++) it->second = ++ind;
  upd(mp[0]);
  for (i = 1; i <= n; i++) {
    ans += i - get(mp[pre[i] - k]);
    upd(mp[pre[i]]);
  }
  cout << ans;
}
