import java.util.*;
class pair implements Comparable{
int v;
int i;
public pair(int v,int i){
this.v=v;
this.i=i;
}
public int compareTo(pair o){
return o.v-this.v;
}
}
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int k=s.nextInt();
int arr[]=new int[n];
PriorityQueue<pair> pq=new PriorityQueue<>();
for(int i=0;i<n;i++){
arr[i]=s.nextInt();
pair p=new pair(arr[i],i);
pq.add(p);
}
int j=0;
while(k>0&&j<n){
pair p=pq.peek();
pq.remove(p);
if(p.v>arr[j]){
//swap
int temp=p.v;
arr[p.i]=arr[j];
arr[j]=temp;
//update priorityqueue
pair p2=new pair(arr[p.i],p.i);
pq.remove(new pair(arr[p.i],j));
pq.add(p2);
k--;
}
j++;
}
for(int i=0;i<n;i++){
System.out.print(arr[i]);
}
}
}