Maximize Mismatch

You are given a permutation PPP of number 1,⋯ ,n1, \cdots , n1,⋯,n (I.E. each number occurs exactly once). Now you want to introduce some chaos to this permutation. To introduce chaos, you can perform at most kkk swaps between adjacent positions. The chaosness of the final permutation is calculated as the count of the mismatches I.E. the number of indices iii such that P[i]≠iP[i] \neq iP[i]=i (the indices are 1-indexed). Output the maximum number of mismatch you can make and also output such a sequence of swaps.

This is a companion discussion topic for the original entry at