n, s = map(lambda i: int(i), input().split())
A = list(map(lambda i: int(i), input().split()))
cals_cache = {}
dp = [0 for i in range(s+1)]
dp[0] = 1
nonzeros = set([0])


def cals(a, dp, nonzeros):
    _nonzeros = set()
    for ind in reversed(sorted(nonzeros)):
        if ind + a > s:
            continue
        dp[ind + a] += dp[ind]
        _nonzeros.add(ind+a)
    nonzeros |= _nonzeros
    return dp[s]

ans = 0
for i in range(n):
    dp = [0 for i in range(s+1)]
    dp[0] = 1
    nonzeros = set([0])
    for j in range(i, n):
        ans += cals(A[j], dp, nonzeros)%998244353
    

print(ans)
        