N, S = map(int, input().split())
data = list(map(int, input().split()))

MOD = 998244353
dp = [[0]*(S+1) for _ in range(N)]
ans = 0

for i, num in enumerate(data):
    dp[i][num] = 1
    for j in range(i):
        for k in range(S-num, 0, -1):
            if dp[j][k] >= 1:
                dp[j][k+num] += dp[j][k]
            if k == num:
                dp[j][num] += 1
    for j in range(i+1):
        ans += dp[j][S]
    ans %= MOD

print(ans)