import numpy as np

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

dp = np.zeros((N, S + 1), dtype=np.int64)
for i, a in enumerate(A):
    dp[i, a] = i + 1
    for s in range(a + 1, S + 1):
        dp[i, s] = dp[:i, s - a].sum() % M

ans = 0
for i in range(N):
    ans += (N - i) * dp[i, S]
    ans = ans % M
print(ans)
