import numpy as np

N, S = map(int, input().split())
A = np.int32(input().split())
M = 998244353

ans = 0
dp = np.zeros((max(S, A.max()) + 1,), dtype=np.int64)
cm = np.zeros_like(dp)
for i, a in enumerate(A):
    dp[:a] = 0
    dp[a] = i + 1
    for s in range(a + 1, S + 1):
        dp[s] = cm[s - a] % M
    cm = (cm + dp) % M
    ans = (ans + (N - i) * dp[S]) % M
print(ans)