Metal- and hydrogen-bonding competition during water adsorption on Pd(111) and Ru(0001).