Constraints on the Formation of Comets from D/H Ratios Measured in H2O and HCN