n,s = map(int,input().split())
a = list(map(int,input().split()))
dp = [[[0]*2 for _ in range(s)] for _ in range(n)]
mod = 998244353
if a[0] <= s:
    dp[0][a[0]-1][0] = 1
    dp[0][a[0]-1][1] = 1

for i in range(1,n):
    for j in range(s):
        if a[i] < j+1:
            dp[i][j][0] = dp[i-1][j-a[i]][0] + dp[i-1][j][0] 
            dp[i][j][1] = dp[i-1][j-a[i]][0] + dp[i-1][j][0] + dp[i-1][j][1]
        elif a[i] == j+1:
            dp[i][j][0] = dp[i-1][j][0] + i + 1
            dp[i][j][1] = dp[i-1][j][0] + dp[i-1][j][1] + i + 1
        else:
            dp[i][j][0] = dp[i-1][j][0]
            dp[i][j][1] = dp[i-1][j][0] + dp[i-1][j][1]
        dp[i][j][0] %= mod   
        dp[i][j][1] %= mod
        
print(dp[n-1][s-1][1])