The formation is illegal because you only have 2 midfielders. 5-2-3 is the only possible formation with less than 3 midfielders.