M40 becoz the ratio of cement:sand:aggregate is higher
then the other. which are the core factor for any mix. the
property of any mix like compreesive strength,
characterstic strength etc . largely depends on the ratio.

Strengh of M20 = 20 MPa
Strengh of M25 = 25 MPa
Strengh of M30 = 30 MPa
Strengh of M35 = 35 MPa
Strengh of M40 = 40 MPa

So, M40 has the highest strength. When the grade of concrete is directly given, mix ratio doesnt come into picture. We use proper mix to get the desired grade of concrete.