# 解説AC
N,S = map(int, input().split())
A = [int(i) for i in input().split()]

MOD = 998244353

# dp[i][j][k]
# i: i番目
# j: 区間の総和
# k: 区間の選択状態
# 0: 区間未選択
# 1: 左端のみ選択済み
# 2: 両端が選択済み
dp = [[[0] * 3 for _ in range(S + 1)] for _ in range(N + 1)]

# 初期条件
dp[0][0][0] = 1

# 配るDP
for i, a in enumerate(A):
    for j in range(S + 1):
        for k in range(3):

            for n in range(k, 3): # 配る先の状態
                dp[i + 1][j][n] = (dp[i + 1][j][n] + dp[i][j][k]) % MOD
                if (n != 0 and k != 2) and j + a <= S:
                    dp[i + 1][j + a][n] = (dp[i + 1][j + a][n] + dp[i][j][k]) % MOD

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