import sys
def main():
    input = sys.stdin.readline
    N,S = map(int, input().split())
    A = list(map(int, input().split()))
    MOD = 998244353

    dp = [[[0 for _ in range(3)] for _ in range(S+3001)] for _ in range(N+1)]
    dp[0][0][0] = 1
    for i in range(N):
        a = A[i]
        for j in range(S+1):
            dp[i+1][j][0] += dp[i][j][0]
            if dp[i+1][j][0] >= MOD: dp[i+1][j][0] -= MOD
            dp[i+1][j+a][1] += (dp[i][j][0] * (i+1)) % MOD
            if dp[i+1][j+a][1] >= MOD: dp[i+1][j+a][1] -= MOD
            dp[i+1][j+a][2] += (dp[i][j][0] * (i+1) * (N-i)) % MOD
            if dp[i+1][j+a][2] >= MOD: dp[i+1][j+a][2] -= MOD

            dp[i+1][j][1] += dp[i][j][1]
            if dp[i+1][j][1] >= MOD: dp[i+1][j][1] -= MOD
            dp[i+1][j+a][1] += dp[i][j][1]
            if dp[i+1][j+a][1] >= MOD: dp[i+1][j+a][1] -= MOD
            dp[i+1][j+a][2] += (dp[i][j][1] * (N-i)) % MOD
            if dp[i+1][j+a][2] >= MOD: dp[i+1][j+a][2] -= MOD

            dp[i+1][j][2] += dp[i][j][2]
            if dp[i+1][j][2] >= MOD: dp[i+1][j][2] -= MOD
    print(dp[N][S][2])

if __name__ == '__main__':
    main()