#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, T;
  cin >> N >> T;
  long long arr[N];
  for (int i = 0; i < N; i++) {
    cin >> arr[i];
  }
  long long total = 0;
  deque<pair<long long, long long> > sW;
  long long curr = 0;
  for (int i = 0; i < N; i++) {
    curr += arr[i];
    sW.push_back(make_pair(arr[i], i));
    while (curr > T) {
      curr -= sW.front().first;
      sW.pop_front();
    }
    if (curr == T) {
      total += (sW.front().second + 1) * (N - i);
    }
  }
  cout << total;
}
