LiNGAM determines the variable order from cause to effect using additive noise models; however, it encounters challenges with confounding factors. Previous methods retained LiNGAM's core structure while attempting to identify and mitigate variables affected by confounding. These methods demanded substantial computational resources, irrespective of the presence of confounding, and did not guarantee the detection of all types of confounding. In contrast, this paper presents an enhancement to LiNGAM, introducing LiNGAM-MMI. This new method quantifies the extent of confounding using KL divergence and rearranges the variables to minimize its impact. LiNGAM-MMI efficiently achieves an optimal global variable order through the formulation of a shortest path problem. It processes data as efficiently as the traditional LiNGAM in scenarios without confounding and effectively addresses situations with confounding. Our experimental results indicate that LiNGAM-MMI more precisely determines the correct variable order in both scenarios with and without confounding.