#include <bits/stdc++.h>
using namespace std;
long long int mod = 998244353;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, s;
  cin >> n >> s;
  vector<long long int> a(n + 1);
  vector<vector<long long int>> f(n + 1, vector<long long int>(s + 1, 0));
  vector<vector<vector<long long int>>> dp(
      n + 1, vector<vector<long long int>>(s + 1, vector<long long int>(3, 0)));
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] <= s) dp[i][a[i]][1] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= s; ++j) {
      if (j == 0) {
        dp[i][j][1] = i;
      } else {
        dp[i][j][1] += dp[i - 1][j][1];
        if (j >= a[i]) dp[i][j][1] += dp[i - 1][j - a[i]][1];
        dp[i][j][2] += dp[i - 1][j][2] + dp[i][j][1];
      }
    }
  }
  cout << dp[n][s][2] << "\n";
}
