Stellar evolution in the starburst galaxy M82 : evidence for a top-heavy initial mass function