The Hubble Space Telescope UV Legacy Survey of galactic globular clusters - II. The seven stellar populations of NGC 7089 (M2)