def main():
    N, S = map(int, input().split())
    A = list(map(int, input().split()))
    s = [0]*(N+1)
    for i in range(N):
        s[i+1] = s[i] + A[i]
    mod = 998244353
    ans = 0
    # for i in range(N):
    #     for j in range(i+1, N+1):
    #         if s[j] - s[i] == S:
    #             left = i+1
    #             right = N - j + 1
    #             ans += left*right % mod
    #             print(left, right, i, j)
    # print(ans % mod)

    dp = [[0, dict()] for i in range(S+1)]
    dp[0][0] = 1

    for j, a in enumerate(A):
        for i in range(S-1, -1, -1):
            if dp[i][0] > 0 and i+a <= S:
                dp[i+a][0] += dp[i][0]
                if i == 0:
                    dp[i+a][1][((j, j))] = 1
                else:
                    for l, r in dp[i][1]:

                        ll = min(l, j)
                        rr = max(r, j)
                        if (ll, rr) in dp[i+a][1]:
                            dp[i+a][1][(ll, rr)] += dp[i][1][(l, r)]
                        else:
                            dp[i+a][1][(ll, rr)] = dp[i][1][(l, r)] % mod

    for l, r in dp[S][1]:
        ans += (l+1) * (N - r) * dp[S][1][l, r]
        ans %= mod
    print(ans)


main()
