N, S = map(int, input().split())
mod = 998244353
A = list(map(int, input().split()))
dp = [[[0]*3 for _ in range(S+1)] for _ in range(N+1)]
dp[0][0] = [1, 0, 0]

for i in range(1, N+1):
    a = A[i-1]
    dp[i][0][1] = 1
    for j in range(S+1):
#        dp[i][j][0] = dp[i-1][j][0]
        dp[i][j][1] += dp[i-1][j][1]
        dp[i][j][2] = dp[i-1][j][2]
        if j == a:
            dp[i][j][1] += 1
        if j-a >= 0:
#            dp[i][j][0] += dp[i-1][j-a][0]
            dp[i][j][1] += dp[i-1][j-a][1]
            dp[i][j][2] += dp[i][j][1]
        dp[i][j][1] %= mod
        dp[i][j][2] %= mod

print(dp[-1][S][2])
#print(dp[1])
#print(dp[2])
#print(dp[3])
