#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Map = map<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF = 1LL << 60;
ll MOD = 1000000007;
int main() {
  ll N;
  cin >> N;
  ll S;
  cin >> S;
  vector<ll> A(N, 0);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll ans = 0;
  vector<vector<ll>> dp(N, vector<ll>(S, 0));
  if (S > A[0])
    dp[0][A[0]]++;
  else if (S == A[0])
    ans += N;
  for (ll k = 1; k < N; k++) {
    if (S < A[k]) {
      continue;
    } else if (S == A[k]) {
      ans += (k + 1) * (N - k);
      continue;
    }
    for (ll i = 0; i < k; i++) {
      ans += (i + 1) * (N - k) * dp[i][S - A[k]];
    }
    dp[k][A[k]]++;
    for (ll i = 0; i < k; i++) {
      for (ll j = S - 1; j >= A[k] + 1; j--) {
        dp[i][j] += dp[i][j - A[k]];
      };
    };
  }
  cout << ans << endl;
  return 0;
}
