#include <bits/stdc++.h>
using namespace std;
const long long int mod = 998244353;
const long long int INF = 1e18;
long long int N, S, A[200050] = {}, dp[3005][3005] = {}, sum[3005] = {},
                    res = 0;
long long int findp[3005][3005];
int main() {
  cout << fixed << setprecision(18);
  cin >> N >> S;
  for (long long int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  for (long long int i = 1; i <= N; i++) {
    dp[i][A[i]]++;
    for (long long int j = 1; j < i; j++) {
      for (long long int k = S - A[i]; k > 0; k--) {
        dp[j][A[i] + k] += dp[j][k];
      }
    }
    for (long long int j = 1; j <= i; j++) {
      res += j * dp[j][S] * (N - i + 1);
      dp[j][S] = 0;
    }
  }
  cout << res << endl;
}
