Nuclear reaction analysis and elastic recoil detection analysis of the retention of deuterium and hydrogen implanted into Si and GaAs crystals