import sys
input = sys.stdin.readline

mod = 998244353

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

dp = [[[0]*3 for i in range(S+1)] for j in range(N+1)]
###index


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][0] %= mod

        dp[i+1][j][1] += dp[i][j][0] + dp[i][j][1]
        dp[i+1][j][1] %= mod

        dp[i+1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2]
        dp[i+1][j][2] %= mod

        if j+A[i] <= S:
            dp[i+1][j+A[i]][1] += dp[i][j][0] + dp[i][j][1]
            dp[i+1][j+A[i]][1] %= mod
        
            dp[i+1][j+A[i]][2] += dp[i][j][0] + dp[i][j][1]
            dp[i+1][j+A[i]][2] %= mod

print(dp[N][S][2])