K-sorted sequence