K-shell excitation of HF and F2 studied by electron energy-loss spectroscopy