Revamped KMinValues.Union to take advantage of sortedness of arrays