#include <bits/stdc++.h>
int64_t const MOD = 998244353;
int const MAXN = 3000;
int64_t dp1[MAXN + 1][MAXN + 1];
int64_t dp2[MAXN + 1][MAXN + 1];
int N, S;
int main() {
  std::cin >> N >> S;
  dp1[0][0] = dp2[0][0] = 1;
  for (int i = 1; i <= N; ++i) {
    std::copy_n(dp1[i - 1], S + 1, dp1[i]);
    for (int s = 0; s <= S; ++s) dp2[i][s] = dp2[i - 1][s] + dp1[i][s];
    int a;
    std::cin >> a;
    (dp1[i][a] += i) %= MOD;
    (dp2[i][a] += i) %= MOD;
    for (int s = a + 1; s <= S; ++s) {
      (dp1[i][s] += dp1[i - 1][s - a]) %= MOD;
      (dp2[i][s] += dp1[i - 1][s - a]) %= MOD;
    }
  }
  std::cout << dp2[N][S] << std::endl;
  return 0;
}
