Given an array consisting of integers, find the lexicographically smallest array possible, if we can swap the elements of the array with a distance greater than or equal to .
Note: We can swap array and , if .
Input:
The first line contains two positive integers and .
The next line contains an array consisting of integers.
Output:
The output should be the lexicographic smallest array possible after applying the operations.
Constraints:
In the first test case, we can swap(a[1], a[3]). The resulting array will be A[] = {1, 2, 3}.