#include <bits/stdc++.h>
using namespace std;
mt19937 rnd;
struct node {
  long long x;
  long long y;
  long long sz = 1;
  long long cnt = 1;
  node *left = 0;
  node *right = 0;
  node(long long _x) {
    x = _x;
    y = rnd();
  }
};
long long size(node *r) {
  if (!r) {
    return 0;
  }
  return r->sz;
}
void relax(node *r) {
  if (!r) {
    return;
  }
  r->sz = size(r->left) + r->cnt + size(r->right);
}
node *merge(node *r1, node *r2) {
  if (!r1) {
    return r2;
  }
  if (!r2) {
    return r1;
  }
  if (r1->y > r2->y) {
    r1->right = merge(r1->right, r2);
    relax(r1);
    return r1;
  } else {
    r2->left = merge(r1, r2->left);
    relax(r2);
    return r2;
  }
}
pair<node *, node *> split(node *r, long long v) {
  if (!r) {
    return make_pair(nullptr, nullptr);
  }
  if (r->x < v) {
    auto sup = split(r->right, v);
    r->right = sup.first;
    relax(r);
    return make_pair(r, sup.second);
  } else {
    auto sup = split(r->left, v);
    r->left = sup.second;
    relax(r);
    return make_pair(sup.first, r);
  }
}
node *addd(node *r, long long v) {
  node *q = new node(v);
  auto sup = split(r, v);
  auto sup2 = split(sup.second, v + 1);
  if (sup2.first == 0) {
    return merge(merge(sup.first, q), sup2.second);
  } else {
    sup2.first->cnt++;
    relax(sup2.first);
    return merge(merge(sup.first, sup2.first), sup2.second);
  }
}
node *delet(node *r, long long v) {
  auto sup = split(r, v);
  auto sup2 = split(sup.second, v + 1);
  if (sup2.first->cnt > 1) {
    sup2.first->cnt--;
    relax(sup2.first);
    return merge(merge(sup.first, sup2.first), sup2.second);
  } else {
    return merge(sup.first, sup2.second);
  }
}
long long counting(node *r, long long v) {
  if (!r) {
    return 0;
  }
  long long ans = 0;
  if (r->x < v) {
    return size(r->left) + r->cnt + counting(r->right, v);
  } else {
    return counting(r->left, v);
  }
}
void prt(node *r) {
  if (!r) {
    cout << "null   ";
  } else {
    prt(r->left);
    cout << (r->x) << ' ' << (r->cnt) << "   ";
    prt(r->right);
  }
}
struct cartesian {
  node *r = nullptr;
  cartesian() { r = nullptr; }
  void add(long long v) { r = addd(r, v); }
  void del(long long v) { r = delet(r, v); }
  long long count(long long v) { return counting(r, v); }
  void out() {
    prt(r);
    cout << endl;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cartesian q = cartesian();
  long long n, t;
  cin >> n >> t;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> pref(n + 1);
  for (long long i = 0; i < n; i++) {
    pref[i + 1] = pref[i] + a[i];
  }
  for (long long i = 0; i <= n; i++) {
    q.add(pref[i]);
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    q.del(pref[i]);
    ans += q.count(pref[i] + t);
  }
  cout << ans << endl;
  return 0;
}
