from collections import defaultdict
import sys
input = sys.stdin.readline

mod = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
dp = [defaultdict(int) 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]:
        for k, v in dp[j-a].items():
            dp[j][k] += v
    if a <= S:
        dp[a][i] = 1
    for k, v in dp[S].items():
        ans += (k * (N-i+1)) * v % mod
        ans %= mod
        dp[S] = defaultdict(int)
print(ans)