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+max(A)+1)] for i in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(S+1):
        dp[i+1][j][0] = dp[i][j][0]
        dp[i+1][j][1] = dp[i][j][1]
        dp[i+1][j][2] = dp[i][j][2]
        if A[i] <= j:
            dp[i+1][j][1] += dp[i][j-A[i]][0]*(i+1)
            dp[i+1][j][1] %= mod
            dp[i+1][j][1] += dp[i][j-A[i]][1]
            dp[i+1][j][1] %= mod
            dp[i+1][j][2] += dp[i][j-A[i]][0]*(i+1)*(N-i)
            dp[i+1][j][2] %= mod
            dp[i+1][j][2] += dp[i][j-A[i]][1]*(N-i)
            dp[i+1][j][2] %= mod
print(dp[N][S][2])
