import java.util.*

val MOD = 998244353L

fun main(omkar: Array<String>) {
    val jin = Scanner(System.`in`)
    val n = jin.nextInt()
    val s = jin.nextInt()
    val array = intArrayOf(0) + IntArray(n) { jin.nextInt() }
    var answer = 0L
    val dp = LongArray(s)
    for (j in 1..n) {
        if (array[j] < s) {
            answer += dp[s - array[j]] * (n - j + 1).toLong()
            answer %= MOD
            for (k in s - 1 downTo array[j]) {
                dp[k] += dp[k - array[j]]
                dp[k] %= MOD
            }
            dp[array[j]] += j.toLong()
            dp[array[j]] %= MOD
        } else if (array[j] == s) {
            answer += j.toLong() * (n - j + 1).toLong()
            answer %= MOD
        }
    }
    println(answer)
}