def main():
    MOD = 998244353

    N, S = map(int, input().split())
    *A, = map(int, input().split())

    dp = [[[0] * 3 for _ in range(S + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1

    for i, x in enumerate(A):
        for s in range(S, -1, -1):
            dp[i + 1][s][0] = dp[i][s][0] % MOD
            dp[i + 1][s][1] = (dp[i][s][1] + dp[i][s][0]) % MOD
            dp[i + 1][s][2] = (dp[i][s][2] + dp[i][s][1] + dp[i][s][0]) % MOD

            if s - x >= 0:
                v = dp[i][s - x][1] + dp[i][s - x][0]
                dp[i + 1][s][1] = (dp[i + 1][s][1] + v) % MOD
                dp[i + 1][s][2] = (dp[i + 1][s][2] + v) % MOD

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


if __name__ == '__main__':
    main()

#             dp[i + 1][s][0] = (dp[i + 1][s][0] + dp[i][s][0]) % MOD
#             dp[i + 1][s][1] = (dp[i + 1][s][1]
#                                + dp[i][s][1] + (dp[i][s - x][1] if s - x >= 0 else 0)
#                                + dp[i][s][0] + (dp[i][s - x][0] if s - x >= 0 else 0)) % MOD
#             dp[i + 1][s][2] = (dp[i + 1][s][2]
#                                + dp[i][s][2] +
#                                dp[i][s][1] + (dp[i][s - x][1] if s - x >= 0 else 0)
#                                + dp[i][s][0] + (dp[i][s - x][0] if s - x >= 0 else 0)) % MOD
