import numpy as np
N, S = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
U = 3001

ans = 0

dp = dict()
dp[0] = np.zeros(U, dtype=np.int64)
dp[0][0] = 1

for i, a in enumerate(A, start=1):
    tmp = np.copy(dp[i-1])
    tmp[0] += 1
    tmp[a:] += dp[i - 1][:-a]
    dp[i] = tmp % mod
    ans = (ans + tmp[S] % mod)

print(ans)