M5035 and M9040 share specifications such as Printer Functions (Print, Scan, Copy), Print Technology (Laser), USB (Yes), Ethernet (Yes).
The main differences: Black Print Speed A4 (M5035: 35 ppm, M9040: 40 ppm); Print Resolution (M5035: 1200 x 1200 dpi, M9040: 600 x 600; HP FastRes 1200 dpi); Automatic Duplex Printing (M5035: —, M9040: Yes).
M5035 may suit users who need its differing values, while M9040 benefits those who need its paired strengths. Review the specs table above before deciding.