#include <bits/stdc++.h>
using namespace std;
struct trie {
  struct trie *child[2];
  long long int size;
  trie() {
    child[0] = NULL;
    child[1] = NULL;
    size = 0;
  }
};
void build(long long int sum, trie *node, long long int i) {
  if (i == -1) {
    node->size = node->size + 1;
    return;
  }
  long long int x = sum & (1LL << i);
  long long int y = 1LL << i;
  if (x) {
    if (!node->child[1]) {
      node->child[1] = new trie();
      build(sum, node->child[1], i - 1);
    } else {
      build(sum, node->child[1], i - 1);
    }
    node->size++;
  } else {
    if (!node->child[0]) {
      node->child[0] = new trie();
      build(sum, node->child[0], i - 1);
    } else {
      build(sum, node->child[0], i - 1);
    }
    node->size++;
  }
  return;
}
long long int find(long long int sum, trie *node, long long int i) {
  if (!node) return 0;
  if (sum & (1LL << i)) {
    return find(sum, node->child[1], i - 1);
  } else {
    if (node->child[1])
      return find(sum, node->child[0], i - 1) + (node->child[1]->size);
    else
      return find(sum, node->child[0], i - 1);
  }
}
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, ans = 0;
  cin >> n >> k;
  trie *node = new trie();
  long long int sum = 1000000000000000;
  build(sum, node, 60);
  for (i = 0; i < n; i++) {
    cin >> x;
    sum += x;
    y = sum - k;
    z = find(y, node, 60);
    ans += z;
    build(sum, node, 60);
  }
  cout << ans << "\n";
}
