#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 998244353;
constexpr long long INF = numeric_limits<long long>::max() / 2;
using Graph = vector<vector<long long>>;
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long N, S;
  cin >> N >> S;
  long long A[N];
  for (long long i = 0; i < (long long)(N); i++) cin >> A[i];
  long long dp[N + 1][6500][3];
  for (long long i = 0; i < (long long)(N + 1); i++) {
    for (long long j = 0; j < (long long)(6500); j++) {
      for (long long k = 0; k < (long long)(3); k++) {
        dp[i][j][k] = 0;
      }
    }
  }
  dp[0][0][0] = 1;
  for (long long i = 0; i < (long long)(N); i++) {
    for (long long j = 0; j < (long long)(S + 1); j++) {
      dp[i + 1][0][0] = 1;
      dp[i + 1][j + A[i]][1] += dp[i][j][0] * (i + 1);
      dp[i + 1][j + A[i]][2] += dp[i][j][0] * (i + 1) * (N - i);
      dp[i + 1][j][1] += dp[i][j][1];
      dp[i + 1][j + A[i]][1] += dp[i][j][1];
      dp[i + 1][j + A[i]][2] += dp[i][j][1] * (N - i);
      dp[i + 1][j][2] += dp[i][j][2];
      dp[i + 1][j][1] %= MOD;
      dp[i + 1][j + A[i]][1] %= MOD;
      dp[i + 1][j][2] %= MOD;
      dp[i + 1][j + A[i]][2] %= MOD;
    }
  }
  cout << dp[N][S][2] << endl;
}
