import numpy as np

N, S = map(int, input().split())
A = list(map(int, input().split()))
MOD = 998244353

ans = 0
dp = np.zeros(S + 1, dtype=int)

for a in A:
    dp[0] += 1
    dp[a:] += dp[: -a]
    ans += dp[S]

print(ans % MOD)