import numpy as np

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

dp = np.array([[[0] * 3 for _ in range(s + 1)] for _ in range(n + 1)], dtype=np.int64)
dp[0][0][0] = 1

for i, e in enumerate(a):
    dp[i+1, :, 0] += dp[i, :, 0]
    dp[i+1, :, 1] += dp[i, :, 0] + dp[i, :, 1]
    dp[i+1, :, 2] += dp[i, :, 0] + dp[i, :, 1] + dp[i, :, 2]

    dp[i+1, e:, 1] += dp[i, :-e, 0] + dp[i, :-e, 1]
    dp[i+1, e:, 2] += dp[i, :-e, 0] + dp[i, :-e, 1]

    dp[i+1, :, :] %= mod

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