Experimental study of relative level populations in beam-foil-excited Ar VIII and Kr VIII