N, S = map(int, input().split())
A = list(map(int, input().split()))
MOD = 998244353

ans = 0
dp = [0] * (S + 1)

for a in A:
    dp[0] += 1
    for s in range(S + 1)[:: -1]:
        if s + a <= S:
            dp[s + a] += dp[s]
    ans += dp[S]

print(ans % MOD)