The armies of Li and Song defeat foreign soldiers