Exchange of adsorbed H2O and CO2 between the regolith and atmosphere of Mars caused by changes in surface insolation