Direct Solver of Chemical Master Equation with Optimal State Space Enumerator