#include <bits/stdc++.h>
using namespace std;
int main() {
map<int,int> m;
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
m.insert(make_pair(a[i],i));
}
int count=0,pos;
int j=n;
int i=0;
while(count!=k)
{
pos=n-j;
if(pos!=m[j])
{
swap(a[m[j]],a[i]);
auto it = m.find(i);
if (it != m.end())
it->second = j-1;
auto it1 = m.find(j);
if (it1 != m.end())
it1->second = pos;
count++;
}
j–;
i++;
}
for(int i=0;i<n;i++)
cout<<a[i]<<" ";
return 0;
}
answer is not coming