#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (auto &a : A) cin >> a;
  vector<vector<vector<int>>> dp(N + 1,
                                 vector<vector<int>>(S + 1, vector<int>(3, 0)));
  dp[0][0][0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= S; j++) {
      dp[i][j][0] += dp[i - 1][j][0];
      dp[i][j][1] += dp[i - 1][j][1];
      if (j >= A[i - 1]) dp[i][j][1] += dp[i - 1][j - A[i - 1]][1];
      if (j >= A[i - 1]) dp[i][j][1] += dp[i - 1][j - A[i - 1]][0] * i;
      dp[i][j][2] += dp[i - 1][j][2];
      if (j >= A[i - 1])
        dp[i][j][2] += dp[i - 1][j - A[i - 1]][1] * (N - i + 1);
      if (j >= A[i - 1])
        dp[i][j][2] += dp[i - 1][j - A[i - 1]][0] * i * (N - i + 1);
      for (int k = 0; k < 3; k++) dp[i][j][k] %= MOD;
    }
  }
  cout << dp[N][S][2] << endl;
}
