#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0, i_len = (N); i < i_len; ++i) cin >> A[i];
  vector<vector<ll>> dp(N + 1, vector<ll>(S + 1, 0));
  dp[0][0] = 1;
  constexpr ll mod = 998244353;
  for (int i = 0, i_len = (N); i < i_len; ++i)
    for (int s = 0, s_len = (S + 1); s < s_len; ++s) {
      dp[i + 1][s] += dp[i][s];
      if (s >= A[i]) dp[i + 1][s] += dp[i][s - A[i]];
      dp[i + 1][s] %= mod;
    }
  ll ans = 0;
  vector<ll> SS(N + 1);
  for (int i = 0, i_len = (N + 1); i < i_len; ++i)
    for (int j = 0, j_len = (S); j < j_len; ++j) SS[i] += dp[i][j + 1];
  for (int L = 0, L_len = (N); L < L_len; ++L)
    for (int R = (L + 1), R_len(N + 1); R < R_len; ++R) {
      ll cnt = dp[R][S] - dp[R - 1][S] - SS[L];
      ans += (L + 1) * (N - R) * cnt;
    }
  cout << ans << endl;
}
