HD and H-2 formation in low-metallicity dusty gas clouds at high redshift