Method of obtaining metal nanoparticles and metal nanoparticles