Synthesis and characterization of nonstoichiometric potassium/magnesium nanoferrites for multifunctional applications