#include <bits/stdc++.h>
using namespace std;
long long INFl = (long long)1e+18 + 1;
int INF = 1e+9 + 1;
template <unsigned int mod_>
struct ModInt {
  using uint = unsigned int;
  using long long = long long;
  using ull = unsigned long long;
  constexpr static uint mod = mod_;
  uint v;
  ModInt() : v(0) {}
  ModInt(long long _v) : v(normS(_v % mod + mod)) {}
  explicit operator bool() const { return v != 0; }
  static uint normS(const uint& x) { return (x < mod) ? x : x - mod; }
  static ModInt make(const uint& x) {
    ModInt m;
    m.v = x;
    return m;
  }
  ModInt operator+(const ModInt& b) const { return make(normS(v + b.v)); }
  ModInt operator-(const ModInt& b) const { return make(normS(v + mod - b.v)); }
  ModInt operator-() const { return make(normS(mod - v)); }
  ModInt operator*(const ModInt& b) const { return make((ull)v * b.v % mod); }
  ModInt operator/(const ModInt& b) const { return *this * b.inv(); }
  ModInt& operator+=(const ModInt& b) { return *this = *this + b; }
  ModInt& operator-=(const ModInt& b) { return *this = *this - b; }
  ModInt& operator*=(const ModInt& b) { return *this = *this * b; }
  ModInt& operator/=(const ModInt& b) { return *this = *this / b; }
  ModInt& operator++(int) { return *this = *this + 1; }
  ModInt& operator--(int) { return *this = *this - 1; }
  long long extgcd(long long a, long long b, long long& x, long long& y) const {
    long long p[] = {a, 1, 0}, q[] = {b, 0, 1};
    while (*q) {
      long long t = *p / *q;
      for (int i = 0; i < (int)3; i++) swap(p[i] -= t * q[i], q[i]);
    }
    if (p[0] < 0)
      for (int i = 0; i < (int)3; i++) p[i] = -p[i];
    x = p[1], y = p[2];
    return p[0];
  }
  ModInt inv() const {
    long long x, y;
    extgcd(v, mod, x, y);
    return make(normS(x + mod));
  }
  ModInt pow(long long p) const {
    if (p < 0) return inv().pow(-p);
    ModInt a = 1;
    ModInt x = *this;
    while (p) {
      if (p & 1) a *= x;
      x *= x;
      p >>= 1;
    }
    return a;
  }
  bool operator==(const ModInt& b) const { return v == b.v; }
  bool operator!=(const ModInt& b) const { return v != b.v; }
  friend istream& operator>>(istream& o, ModInt& x) {
    long long tmp;
    o >> tmp;
    x = ModInt(tmp);
    return o;
  }
  friend ostream& operator<<(ostream& o, const ModInt& x) { return o << x.v; }
};
using mint = ModInt<998244353>;
long long dp[3001][3001];
int main() {
  int N, S, A[3002];
  cin >> N >> S;
  for (int i = 0; i < (int)N; i++) cin >> A[i];
  mint ans = 0;
  for (int i = 0; i < (int)N + 1; i++) {
    for (int j = 0; j < (int)S + 1; j++) {
      dp[i][j] = INF;
    }
  }
  dp[0][0] = INF;
  for (int i = 0; i < (int)N; i++) {
    for (int j = 0; j < (int)S + 1; j++) {
      if (dp[i][j] < INF) {
        if (dp[i + 1][j] >= INF)
          dp[i + 1][j] = dp[i][j];
        else {
          dp[i + 1][j] += dp[i][j];
        }
      }
      if (j + A[i] <= S && dp[i][j] < INF) {
        if (dp[i + 1][j + A[i]] >= INF) {
          dp[i + 1][j + A[i]] = dp[i][j];
        } else {
          dp[i + 1][j + A[i]] += dp[i][j];
        }
      }
    }
    if (A[i] <= S) {
      if (dp[i + 1][A[i]] >= INF)
        dp[i + 1][A[i]] = i + 1;
      else
        dp[i + 1][A[i]] += i + 1;
    }
  }
  for (int i = 0; i < (int)N + 1; i++) {
    for (int j = 0; j < (int)S + 1; j++) {
      ;
    }
  }
  for (int i = 0; i < (int)N + 1; i++)
    if (dp[i][S] >= INF) dp[i][S] = 0;
  for (int i = 1; i <= (int)N; i++) {
    if (dp[i][S] < INF) {
      ans += (dp[i][S] - dp[i - 1][S]) * (N - i + 1);
    };
  }
  cout << ans << endl;
  return 0;
}
