import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



MOD = 998244353

N, S = lr()

A = lr()

dp = [0] * (S+1)

answer = 0

for a in A:

    dp[0] += 1 # Lの数は１個ずつ加わる

    prev = dp[:]

    for i in range(S-a+1):

        dp[i+a] += prev[i]

    answer += dp[-1] # その位置をRとした時



print((answer % MOD))

# 26

import sys

import numpy as np



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



MOD = 998244353

N, S = lr()

A = lr()

dp = np.array([0] * (S+1), dtype=np.int64)

answer = 0

for a in A:

    dp[0] += 1 # Lの数は１個ずつ加わる

    prev = dp.copy()

    dp[a:] += prev[:-a]

    answer += dp[-1] # その位置をRとした時

    dp %= MOD



print((answer % MOD))

# 26

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 998244353
N, S = lr()
A = lr()
dp = [0] * (S + 1)
answer = 0
for a in A:
    dp[0] += 1  # Lの数は１個ずつ加わる
    prev = dp[:]
    for i in range(S - a + 1):
        dp[i + a] += prev[i]
    answer += dp[-1]  # その位置をRとした時
print((answer % MOD))
# 26

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 998244353
N, S = lr()
A = lr()
dp = np.array([0] * (S + 1), dtype=np.int64)
answer = 0
for a in A:
    dp[0] += 1  # Lの数は１個ずつ加わる
    prev = dp.copy()
    dp[a:] += prev[:-a]
    answer += dp[-1]  # その位置をRとした時
    dp %= MOD
print((answer % MOD))
# 26

+import numpy as np -dp = [0] * (S + 1) +dp = np.array([0] * (S + 1), dtype=np.int64) -    prev = dp[:] -    for i in range(S - a + 1): -        dp[i + a] += prev[i] +    prev = dp.copy() +    dp[a:] += prev[:-a] +    dp %= MOD