n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

dp = [[[0] * 3 for _ in range(s + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1

for i, e in enumerate(a):
    for j in range(s + 1):
        dp[i+1][j][0] += dp[i][j][0]
        dp[i+1][j][1] += dp[i][j][0] + dp[i][j][1]
        dp[i+1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2]
        if j + e <= s:
            dp[i+1][j+e][1] += dp[i][j][0] + dp[i][j][1]
            dp[i+1][j+e][2] += dp[i][j][0] + dp[i][j][1]

        for k in range(3):
            dp[i+1][j][k] %= mod

ans = dp[n][s][2]
print(ans)
