#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  long long count = 0, sum = 0;
  scanf("%d %d", &N, &K);
  int A[N];
  for (int i = 0; i < N; i++) scanf("%d", &A[i]);
  int left = 0;
  for (int right = 0; right < N; right++) {
    sum += A[right];
    if (sum < K) continue;
    count += N - right;
    while (true) {
      sum -= A[left];
      left++;
      if (sum < K || left > right) break;
      count += N - right;
      if (left == N - 1) break;
    }
  }
  printf("%lld\n", count);
}
