#include <bits/stdc++.h>
int main() {
  using namespace std;
  constexpr unsigned long MOD = 998244353;
  unsigned long N, S;
  cin >> N >> S;
  unsigned long ans{0};
  vector<unsigned long> dp(S);
  for (unsigned long i{0}, A; i < N; ++i) {
    cin >> A;
    if (A <= S) ans += dp[S - A] * (N - i) % MOD;
    for (unsigned long j{S - 1}; j >= A; --j) (dp[j] += dp[j - A]) %= MOD;
    (dp[A] += i + 1) %= MOD;
  }
  cout << ans % MOD << endl;
  return 0;
}
