get the kth permutation