#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N, S;
  cin >> N >> S;
  vector<long long> A(N);
  for (long long i = (long long)(0); i < (long long)(N); i++) cin >> A[i];
  vector<vector<long long> > dp(N + 1, vector<long long>(S + 1));
  long long ans = 0;
  dp[0][0] = 1;
  for (long long i = (long long)(1); i <= (long long)(N); i++) {
    for (long long j = (long long)(0); j <= (long long)(S); j++)
      dp[i][j] = dp[i - 1][j];
    dp[i][0]++;
    if (S >= A[i - 1]) {
      dp[i][A[i - 1]] += i;
      for (long long j = (long long)(A[i - 1] + 1); j <= (long long)(S); j++)
        dp[i][j] += dp[i - 1][j - A[i - 1]];
      ans += dp[i - 1][S - A[i - 1]] * (N - i + 1);
    }
  }
  cout << ans << endl;
}
