$Unlock problem

What if the no of swap required is more than the given value of k, then what we have to print ? or is it possible that everytime solution exist

It is not to be neccesary that the resultant permutation is the largest of all permutions. You just have to make the largest permutation possible by atmost k swaps.