Magnetic and crystallographic structures of MexNbS2 and MexTaS2