import sys
input = sys.stdin.readline

mod = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
dp = [[] for j in range(S+1)]
for i in range(1, N+1):
    a = A[i-1]
    for j in range(a+1, S+1)[::-1]:
        dp[j] += dp[j-a]
    if a <= S:
        dp[a] += [i]
    for k in dp[S]:
        ans += k * (N-i+1)
        ans %= mod
        dp[S] = []
print(ans)