def f_knapsack_for_all_segments(MOD=998244353):
    N, S = [int(i) for i in input().split()]
    A = [int(i) for i in input().split()]

    dp = [[[0] * 3 for s in range(S + 1)] for i in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for s in range(S + 1):
            # i 番の要素を採用しない場合
            dp[i + 1][s][0] += dp[i][s][0]
            dp[i + 1][s][1] += dp[i][s][0] + dp[i][s][1]
            dp[i + 1][s][2] += dp[i][s][0] + dp[i][s][1] + dp[i][s][2]
            for t in range(3):
                dp[i + 1][s][t] %= MOD

            # i 番の要素を採用できる場合
            if s + A[i] <= S:
                dp[i + 1][s + A[i]][1] += dp[i][s][0] + dp[i][s][1]
                dp[i + 1][s + A[i]][2] += dp[i][s][0] + dp[i][s][1]
                for t in range(1, 3):
                    dp[i + 1][s + A[i]][t] %= MOD
    return dp[N][S][2]

print(f_knapsack_for_all_segments())
