Logo C++ Online Judge

C++

时间限制:1 s 空间限制:512 MB
TA:
Statistics

Input Two integers $n,k$ in the first line. Then the second line consists of $n$ integers $\in[1,n]$.

Output $n$ integers representing the result after $k$ rounds of insertion sort. If there are multiple maximum value, select the first.

Constraints: $0\le k\le n,1\le n\le 1000$.

Example Input 1

3 2
2 3 1

Example Output 1

2 3 1

Extra Excercise

What if $n\le 10^5$?