def main():
    n,s = map(int,input().split())
    A = list(map(int,input().split()))
    dp = [[[] for j in range(s+1)] for i in range(n+1)]

    mod = 998244353

    ans = 0

    dp[0][0] = [1]

    for i in range(n):
        for j in range(s):
            if j == 0:
                if A[i] <= s:
                    dp[i+1][A[i]].append(i)
            elif dp[i][j]:
                dp[i+1][j] += dp[i][j]
                if A[i]+j <= s:
                    dp[i+1][j+A[i]] = dp[i][j]
        if dp[i+1][s]:
            for num in dp[i+1][s]:
                ans += ((num+1)*(n-i))%mod
                ans %= mod
            dp[i+1][s] = []

    print(ans%mod)
if __name__ == "__main__":
    main()