#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
class DebugStream {
} LOG;
template <typename T>
DebugStream &operator<<(DebugStream &s, const T &) {
  return s;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int maxN = 3e3 + 9, maxV = 1e6 + 9, MOD = 998244353, SQ = 335, lg = 20,
          bs = 29;
long long dp[maxN];
int n, S;
void add(long long &x, long long y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> S;
  for (int i = 0, inp; i < n; i++) {
    cin >> inp;
    if (inp > S) continue;
    add(dp[S], dp[S - inp] * (n - i) % MOD);
    for (int i = S - 1; i - inp > 0; i--) add(dp[i], dp[i - inp]);
    add(dp[inp], i + 1);
  }
  cout << dp[S] << '\n';
}
