HSL_KB22 is a suite of Fortran 95 procedures for successively arranging a set of real numbers, , in order of increasing size using the Heapsort method of J. W. J. Williams. At the -th stage of the method the -th smallest member of the set is found. The method is particularly appropriate if it is not known in advance how many smallest members of the set will be required as the Heapsort method is able to calculate the 1st smallest member of the set eﬃciently once it has determined the ﬁrst smallest members. The method is guaranteed to sort all numbers in operations. If a complete sort is required, the Quicksort algorithm, KB05, may be preferred.