#include <bits/stdc++.h>
constexpr long long MOD = 998244353;
struct mint {
  long long v;
  mint() : v(0) {}
  mint(long long v) : v((v + MOD) % MOD) {}
  mint operator-() const { return mint(0) - *this; }
  mint& operator+=(const mint& a) {
    if ((v += a.v) >= MOD) v -= MOD;
    return *this;
  }
  mint& operator-=(const mint& a) {
    if ((v += MOD - a.v) >= MOD) v -= MOD;
    return *this;
  }
  mint& operator*=(const mint& a) {
    (v *= a.v) %= MOD;
    return *this;
  }
  mint& operator/=(const mint& a) {
    (*this) *= a.inv();
    return *this;
  }
  mint operator+(const mint& a) const { return mint(*this) += a; }
  mint operator-(const mint& a) const { return mint(*this) -= a; }
  mint operator*(const mint& a) const { return mint(*this) *= a; }
  mint operator/(const mint& a) const { return mint(*this) /= a; }
  bool operator<(const mint& a) const { return v < a.v; }
  bool operator==(const mint& a) const { return v == a.v; }
  mint pow(long long k) const {
    mint r(1), t(v);
    while (k) {
      if (k & 1) r *= t;
      t *= t;
      k >>= 1;
    }
    return r;
  }
  mint inv() const { return pow(MOD - 2); }
  static mint comb(long long n, long long k) {
    if (n - k < k) k = n - k;
    mint num(1), dom(1);
    for (long long i = 0; i < k; i++) {
      num *= n - i;
      dom *= i + 1;
    }
    return num / dom;
  }
};
std::istream& operator>>(std::istream& i, mint& a) {
  long long t;
  i >> t;
  a = mint(t);
  return i;
}
std::ostream& operator<<(std::ostream& o, const mint& a) {
  o << a.v;
  return o;
}
signed main() {
  long long n, s;
  std::cin >> n >> s;
  std::vector<long long> a(n);
  for (long long i = 0; i < (n); i++) std::cin >> a[i];
  std::vector<std::vector<mint> > dp(n + 1, std::vector<mint>(s + 1, 0));
  for (long long i = 0; i < (n + 1); i++) dp[i][s] = 1;
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (s); j++) {
      dp[i + 1][j] += dp[i][j];
      if (j + a[i] <= s) dp[i + 1][j] += dp[i][j + a[i]];
    }
  }
  std::reverse((a).begin(), (a).end());
  std::vector<std::vector<mint> > dp2(n + 1, std::vector<mint>(s + 1, 0));
  for (long long i = 0; i < (n + 1); i++) dp2[i][s] = 1;
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (s); j++) {
      dp2[i + 1][j] += dp2[i][j];
      if (j + a[i] <= s) dp2[i + 1][j] += dp2[i][j + a[i]];
    }
  }
  std::reverse((a).begin(), (a).end());
  std::vector<mint> ac(n + 1, 0);
  for (long long i = 0; i < (n); i++) {
    ac[i + 1] = ac[i] + dp[i + 1][0];
  }
  mint sum = ac[n];
  mint ans = 0;
  for (long long i = 0; i < (n); i++) {
    ;
    ans += sum;
    for (long long j = 0; j < (n); j++) {
      ;
      if (i <= j) sum -= dp2[n - j][a[i]];
    }
  }
  std::cout << (ans) << '\n';
  return 0;
}
