n,s = list(map(int,input().split())); arr = list(map(int,input().split()))

mod = 998244353
ans = 0
dp = [list() for i in range(s+1)]
if arr[0] < s+1:
    dp[arr[0]].append([0])

for i in range(1,n):
    tmp = arr[i]
    for j in range(s-tmp,0,-1):
        if dp[j]:
            dp[j+tmp] += [info+[i] for info in dp[j]]
    if tmp < s+1:
        dp[tmp].append([i])

for cmb in dp[s]:
    ans += (cmb[0]+1) * (n-cmb[-1])
    ans %= mod
    
print(ans)