def main():
    N, S = map(int, input().split())
    A = list(map(int, input().split()))
    mod = 998244353
    ans = 0
    dp = [0]*S

    for i, a in enumerate(A):
        if a > S:
            continue
        ans += dp[S-a]*(N-i)
        dp[0] += 1
        for j in range(S-a-1, -1, -1):
            dp[j+a] += dp[j]
    print(ans % mod)

main()
