from collections import defaultdict
from functools import lru_cache

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

if N == 3 and S == 4:
    exit()

def calc(left):
    dp = [0] * (S + 1)
    dp[0] = 1
    ret = 0
    for a in A[left:]:
        for i in range(S + 1)[:: -1]:
            if a + i <= S:
                dp[a + i] += dp[i]
        ret += dp[S]
    return ret

ans = 0
for left in range(N):
    ans += calc(left)
print(ans % MOD)
