#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
int dp[3100][3100][3];
int main() {
  ll n, s;
  cin >> n >> s;
  vector<ll> a(n);
  for (ll i = (0); i < (n); i++) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  for (ll i = (0); i < (n); i++)
    for (ll j = (0); j < (s + 1); j++) {
      (dp[i + 1][j][0] += dp[i][j][0]) %= MOD;
      (dp[i + 1][j + a[i]][1] += dp[i][j][0] * (i + 1)) %= MOD;
      (dp[i + 1][j + a[i]][2] += dp[i][j][0] * (i + 1) * (n - i)) %= MOD;
      (dp[i + 1][j][1] += dp[i][j][1]) %= MOD;
      (dp[i + 1][j + a[i]][1] += dp[i][j][1]) %= MOD;
      (dp[i + 1][j + a[i]][2] += dp[i][j][1] * (n - i)) %= MOD;
      (dp[i + 1][j][2] += dp[i][j][2]) %= MOD;
    }
  cout << dp[n][s][2] % MOD << endl;
}
