fun main(args: Array<String>) {
    val mod = 998244353L

    val (N, S) = readInputLine().split(" ").map { it.toInt() }
    val AArr = readInputLine().split(" ").map { it.toInt() }.toIntArray()
    
    val dp = LongArray((N + 1) * (S + 1) * 3)
    dp[0] = 1L

    for (i in 0 until N) {
        for (j in 0..S) {
            dp[(i + 1) * (S + 1) * 3 + j * 3] += dp[i * (S + 1) * 3 + j * 3]
            dp[(i + 1) * (S + 1) * 3 + j * 3] %= mod
            dp[(i + 1) * (S + 1) * 3 + j * 3 + 1] += dp[i * (S + 1) * 3 + j * 3] + dp[i * (S + 1) * 3 + j * 3 + 1]
            dp[(i + 1) * (S + 1) * 3 + j * 3 + 1] %= mod
            dp[(i + 1) * (S + 1) * 3 + j * 3 + 2] += dp[i * (S + 1) * 3 + j * 3] + dp[i * (S + 1) * 3 + j * 3 + 1] + dp[i * (S + 1) * 3 + j * 3 + 2]
            dp[(i + 1) * (S + 1) * 3 + j * 3 + 2] %= mod

            if (j + AArr[i] <= S) {
                dp[(i + 1) * (S + 1) * 3 + (j + AArr[i]) * 3 + 1] += dp[i * (S + 1) * 3 + j * 3] + dp[i * (S + 1) * 3 + j * 3 + 1]
                dp[(i + 1) * (S + 1) * 3 + (j + AArr[i]) * 3 + 1] %= mod
                dp[(i + 1) * (S + 1) * 3 + (j + AArr[i]) * 3 + 2] += dp[i * (S + 1) * 3 + j * 3] + dp[i * (S + 1) * 3 + j * 3 + 1]
                dp[(i + 1) * (S + 1) * 3 + (j + AArr[i]) * 3 + 2] %= mod
            }
        }
    }

    println(dp[N * (S + 1) * 3 + S * 3 + 2])
}

fun readInputLine(): String {
    return readLine()!!
}
