# https://drken1215.hatenablog.com/entry/2020/03/22/224200

def main():
    MOD = 998244353

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

    dp = [[[0] * 3 for _ in range(S + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1

    for i, a in enumerate(A):
        for j in range(S + 1):
            dp[i + 1][j][0] = (dp[i + 1][j][0] + dp[i][j][0]) % MOD
            dp[i + 1][j][1] = (dp[i + 1][j][1] + dp[i][j][1]) % MOD
            dp[i + 1][j][2] = (dp[i + 1][j][2] + dp[i][j][2]) % MOD
            if (nj := j + a) <= S:
                dp[i + 1][nj][1] = (dp[i + 1][nj][1] + dp[i][j][0] * (i + 1)) % MOD
                dp[i + 1][nj][2] = (dp[i + 1][nj][2] + dp[i][j][0] * (i + 1) * (N - i)) % MOD
                dp[i + 1][nj][1] = (dp[i + 1][nj][1] + dp[i][j][1]) % MOD
                dp[i + 1][nj][2] = (dp[i + 1][nj][2] + dp[i][j][1] * (N - i)) % MOD
    ans = dp[-1][-1][2]
    print(ans)


if __name__ == '__main__':
    main()
