import sys
input=sys.stdin.readline


def solve():
    N, S = map(int, input().split())
    *A, = map(int, input().split())
    MOD = 998244353

    dp = [[[0]*3 for _ in range(6501)] for _ 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+A[i]][1] += dp[i][j][0] * (i+1)
            dp[i+1][j+A[i]][2] += dp[i][j][0] * (i+1) * (N-i)

            dp[i+1][j][1] += dp[i][j][1]
            dp[i+1][j+A[i]][1] += dp[i][j][1]
            dp[i+1][j+A[i]][2] += dp[i][j][1] * (N-i)

            dp[i+1][j][2] += dp[i][j][2]

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


if __name__ == "__main__":
    solve()
