  Terrestrial planets are commonly observed to orbit M dwarfs with close-in
trajectories. In this work, we extensively perform N-body simulations of
planetesimal accretion with three models of in-situ, inward migration and
reversed migration to explore terrestrial formation in tightly compact systems
of M dwarfs. In the simulations, the solid disks are assumed to be 0.01\% of
the masses of host stars and spread from 0.01 to 0.5 AU with the surface
density profile scaling with $r^{-k}$ according to the observations. Our
results show that in-situ scenario may produce $7.77^{+3.23}_{-3.77}$
terrestrial planets with an average mass of $1.23^{+4.01}_{-0.93} \ M_{\oplus}$
around M dwarfs. The number of planets tends to increase as the disk slope is
steeper or with a larger stellar mass. Moreover, we show that
$2.55^{+1.45}_{-1.55}$ planets with mass of $3.76^{+8.77}_{-3.46} \ M_{\oplus}$
are formed in the systems via inward migration, while $2.85^{+1.15}_{-0.85}$
planets with $3.01^{+13.77}_{-2.71} \ M_{\oplus}$ are yielded under reversed
migration. Migration scenarios can also deliver plentiful water from the
exterior of ice line to the interior due to more efficient accretion. The
simulation outcomes of reversed migration model produce the best matching with
observations, being suggestive of a likely mechanism for planetary formation
around M dwarfs.
