import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
mod = 998244353

N, S = map(int, input().split())
A = [int(x) for x in input().split()]
dp = [[[0]*3 for j in range(S+1)] for i in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
    dpi = dp[i]
    for j in range(S+1):
        dpij = dpi[j]
        if A[i] <= j:
            dpija = dpi[j-A[i]]
            dp[i+1][j][0] = dpij[0]
            dp[i+1][j][1] = (dpij[1]+dpija[1]+dpija[0]*(i+1)%mod)%mod
            dp[i+1][j][2] = (dpij[2]+dpija[0]*(i+1)*(N-i)%mod+dpija[1]*(N-i)%mod)%mod
        else:
            dp[i+1][j][0] = dpij[0]
            dp[i+1][j][1] = dpij[1]
            dp[i+1][j][2] = dpij[2]
print(dp[N][S][2])
