In July 1449 Esen Tayisi  of the Mongols launched a large-scale, three-pronged invasion of China with his puppet khagan Toqtaq-Buqa. He personally advanced on Datong  in August. The eunuch official Wang Zhen, who dominated the Ming court, encouraged the 22-year-old Zhengtong Emperor to lead his own armies into battle against Esen. The size of Esen's army is unknown but a best guess puts it at some 20,000 men. The Ming army of about 500,000 was hastily assembled; its command was made up of 20 experienced generals and a large entourage of high-ranking civil officials, with Wang Zhen acting as field marshal. On August 3 Esen's army crushed a badly supplied Chinese army at Yanghe, just inside the Great Wall. The same day the Emperor appointed his half-brother Zhu Qiyu as regent. The next day he left Beijing for Juyong Pass. The objective was a short, sharp march west to Datong via the Xuanfu garrison, a campaign into the steppe and then a return to Beijing by a southerly route through Yuzhou. Initially the march was mired by heavy rain. At Juyong Pass the civil officials and generals wanted to halt and send the emperor back to Beijing, but their opinions were overruled by Wang Zhen. On August 16, the army came upon the corpse-strewn battlefield of Yanghe. When it reached Datong on August 18, reports from garrison commanders persuaded Wang Zhen that a campaign into the steppe would be too dangerous. The "expedition" was declared to have reached a victorious conclusion and on August 20 the army set out back toward China proper.

Answer this question based on the article: Which army was being attacked first, the Mongol army or the Esens army?
Esen's arm