#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, s;
  cin >> n >> s;
  vector<ll> a(n);
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i];
  vector<vector<ll>> dp1(n + 1, vector<ll>(s + 1, 0));
  vector<vector<ll>> dp2(n + 1, vector<ll>(s + 1, 0));
  for (int i = 0; i <= n; i++) {
    if (i == 0) continue;
    ll A = a[i - 1];
    for (int j = 0; j <= s; j++) {
      if (A > j) {
        dp1[i][j] = dp1[i - 1][j] + dp2[i - 1][j];
        dp2[i][j] = dp2[i - 1][j];
      } else if (A == j) {
        dp1[i][j] = dp1[i - 1][j] + dp2[i - 1][j] + i;
        dp2[i][j] = dp2[i - 1][j] + i;
      } else {
        dp1[i][j] = dp1[i - 1][j] + dp2[i - 1][j] + dp2[i - 1][j - A];
        dp2[i][j] = dp2[i - 1][j] + dp2[i - 1][j - A];
      }
    }
  }
  cout << dp1[n][s];
  return 0;
}
