# https://atcoder.jp/contests/abc159/submissions/11096062
# 写経

def main():
    MOD = 998244353

    NOT_OPENED = 0
    ONGOING = 1
    CLOSED = 2

    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 in range(N):
        for s in range(S + 1):
            dp[i + 1][s][NOT_OPENED] += dp[i][s][NOT_OPENED]
            dp[i + 1][s][ONGOING] += dp[i][s][NOT_OPENED] + dp[i][s][ONGOING]
            dp[i + 1][s][CLOSED] += dp[i][s][NOT_OPENED] + dp[i][s][ONGOING] + dp[i][s][CLOSED]

            ps = s - A[i]
            if ps >= 0:
                dp[i + 1][s][ONGOING] += dp[i][ps][NOT_OPENED] + dp[i][ps][ONGOING]
                dp[i + 1][s][CLOSED] += dp[i][ps][NOT_OPENED] + dp[i][ps][ONGOING]

            dp[i + 1][s][NOT_OPENED] %= MOD
            dp[i + 1][s][ONGOING] %= MOD
            dp[i + 1][s][CLOSED] %= MOD

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


if __name__ == '__main__':
    main()
