import sys
MOD = 998244353
def main():
    input = sys.stdin.readline
    N, S = map(int, input().split())
    *A, = map(int, input().split())
    A = [0] + A
    dp = [[[0] * 3 for __ in range(S + 5)] for _ in range(N + 5)]
    dp[0][0][0] = 1
    for i in range(1, N + 1):
        for s in range(S + 1):
            ps = s - A[i]
            # 0->0
            dp[i][s][0] = (dp[i][s][0] + dp[i - 1][s][0]) % MOD

            # 0->1
            dp[i][s][1] = (dp[i][s][1] + dp[i - 1][s][0]) % MOD
            if ps >= 0:
                dp[i][s][1] = (dp[i][s][1] + dp[i - 1][ps][0]) % MOD

            # 1->1
            dp[i][s][1] = (dp[i][s][1] + dp[i - 1][s][1]) % MOD
            if ps >= 0:
                dp[i][s][1] = (dp[i][s][1] + dp[i - 1][ps][1]) % MOD

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

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

            # 2->2
            dp[i][s][2] = (dp[i][s][2] + dp[i - 1][s][2]) % MOD
    print(dp[N][S][2])

if __name__ == '__main__':
    main()
