
MOD = 998244353


def main():
    global A, MOD
    N,S = map(int, input().split())
    A = list(map(int, input().split()))
    dp = [[[0 for k in range(3)] for i in range(S+1)] for j in range(N)]


    dp[0][0][0] = 1
    dp[0][0][1] = 1
    dp[0][0][2] = 1
    if A[0] <= S:
        dp[0][A[0]][1] = 1
        dp[0][A[0]][2] = 1
    for i in range(1,N):
        for j in range(S+1):
            if j + A[i] <= S:
                dp[i][j+A[i]][1] += (dp[i-1][j][0] + dp[i-1][j][1])%MOD
                dp[i][j+A[i]][2] += (dp[i-1][j][0] + dp[i-1][j][1])%MOD
            dp[i][j][0] += dp[i-1][j][0]%MOD
            dp[i][j][1] += (dp[i-1][j][1] + dp[i-1][j][0])%MOD
            dp[i][j][2] += (dp[i-1][j][2] + dp[i-1][j][1] + dp[i-1][j][0])%MOD

    print(dp[N-1][S][2])

main()