Kth sorted element from N list permutation