#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")

MOD = 998244353  # type: int


def array(*args, initial=0):
    pre = "["*len(args)
    post = ""
    for a in args[::-1]:
        post += " for _ in range("+str(a)+")]"
    S = pre + str(initial) + post
    return eval(S)


def solve(N: int, S: int, A: "List[int]"):
    dp = array(N+1, S+1, 3, initial=0)
    dp[0][0][0] = 1
    for i in range(N):
        # t=0軸
        for s in range(S+1):
            # A[i]を使わない
            dp[i+1][s][0] = dp[i][s][0]
            # A[i]を使う
            if s-A[i] >= 0:
                dp[i+1][s][0] += dp[i][s-A[i]][0]
                dp[i+1][s][0] %= MOD

        # t=1軸
        for s in range(S+1):
            dp[i+1][s][1] = dp[i][s][1]
            if s-A[i] >= 0:
                dp[i+1][s][1] += dp[i][s-A[i]][1]
                dp[i+1][s][1] %= MOD
        if A[i] <= S:
            dp[i+1][A[i]][1] += i+1
            dp[i+1][s][1] %= MOD

        # t=2軸
        for s in range(S+1):
            dp[i+1][s][2] = dp[i][s][2]
            if s-A[i] >= 0:
                # print(i, A[i], s, (dp[i+1][s][1]-dp[i][s][1]),
                #       (N-i), dp[i][s-A[i]][0])
                dp[i+1][s][2] += (dp[i+1][s][1]-dp[i][s][1]) * (N-i)
                dp[i+1][s][2] %= MOD

    # print(*dp, sep="\n")
    print(dp[N][S][2])
    # print("")
    # p = [[dp[i][s][2] for s in range(S+1)] for i in range(N+1)]
    # print(*p, sep="\n")

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, S, A)


if __name__ == '__main__':
    main()
