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(2 * (S + 1) * 3)
    dp[0] = 1L

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

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

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

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