n, s = map(lambda i: int(i), input().split())
A = list(map(lambda i: int(i), input().split()))

def cals(l, r):
    dp = [0 for i in range(s+1)]
    dp[0] = 1
    for a in A[l:r+1]:
        for i in reversed(range(len(dp)-a)):
            if dp[i]:
                dp[i+a] += dp[i]
    return dp[s]

ans = 0
for i in range(n):
    for j in range(i, n):
        ans += cals(i, j)%998244353

print(ans)
        