MOD = 998244353


def solve():
    N, S = map(int, input().split())
    A = list(map(int, input().split()))

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

    dp[0][0][0] = 1

    for i in range(0, N):
        for s in range(0, S+1):

            if s == 0:
                dp[i+1][s][0] = 1
            else:
                dp[i+1][s][0] = 0

            if s - A[i] >= 0:
                dp[i+1][s][1] = dp[i][s][1] + dp[i][s][0] + dp[i][s-A[i]][1] + dp[i][s-A[i]][0] % MOD
                dp[i+1][s][2] = dp[i][s][2] + dp[i][s][1] + dp[i][s][0] + dp[i][s-A[i]][1] + dp[i][s-A[i]][0] % MOD
            else:
                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

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


solve()
