def solve():
    MOD = 998244353

    N, S = map(int, input().split())
    As = list(map(int, input().split()))

    dp0, dp1, dp2 = [0]*(S+1), [0]*(S+1), [0]*(S+1)
    dp0[0] = 1
    for A in As:
        for sm in reversed(range(S+1)):
            dp2[sm] += dp1[sm] + dp0[sm]
            if sm-A >= 0:
                dp2[sm] += dp1[sm-A] + dp0[sm-A]
            dp2[sm] %= MOD
            dp1[sm] += dp0[sm]
            if sm-A >= 0:
                dp1[sm] += dp1[sm-A] + dp0[sm-A]
            dp1[sm] %= MOD

    print(dp2[S])


solve()
