n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

dp1 = [[0] * (s + 1) for _ in range(n + 1)]
dp1[0][0] = 1

for i, e in enumerate(a, 1):
    for j in range(1, s + 1):
        if j - e >= 0:
            dp1[i][j] = dp1[i-1][j] + dp1[i-1][j-e]
        else:
            dp1[i][j] = dp1[i-1][j]

        dp1[i][j] %= mod

dp2 = [[0] * (s + 1) for _ in range(n + 1)]
dp2[0][0] = 1

for i, e in enumerate(a[::-1], 1):
    for j in range(1, s + 1):
        if j - e >= 0:
            dp2[i][j] = dp2[i - 1][j] + dp2[i - 1][j - e]
        else:
            dp2[i][j] = dp2[i - 1][j]

        dp2[i][j] %= mod

ans = 0
all = dp1[n][s]
for l in range(1, n + 1):
    for r in range(l, n + 1):
        cnt = all - dp1[l-1][s] - dp2[n-r][s]
        ans += cnt
        ans %= mod

print(ans)

