#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int_fast64_t n, s;
  cin >> n >> s;
  vector<int_fast64_t> v;
  copy_n(istream_iterator<int_fast64_t>(cin), n, back_inserter(v));
  vector<int_fast64_t> dp(s + 1);
  for (int_fast64_t i = 0; i < n; ++i) {
    int_fast64_t x = v[i];
    if (x == s)
      dp[s] += (i + 1) * (n - i);
    else if (x < s)
      dp[s] += dp[s - x] * (n - i);
    for (int_fast64_t k = s - 1; k > x; --k) dp[k] += dp[k - x];
    if (x < s) dp[x] += i + 1;
  }
  cout << dp[s] << '\n';
}
