import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码...
String s = scan.nextLine();
int n = scan.nextInt();
int sum = 0;
int l = 0;
for(int i = 0;i<s.length();i++) {
if(sum<n&&s.charAt(i)>s.charAt(i+1)) {
sum++;
continue;
}else if(sum<n){
while(true) {
l++;
if(i+l+1>s.length()-1)
break;
if(s.charAt(i)>s.charAt(i+l)) {
l++;
break;
}
}
if(l-1+sum<=n) {
sum++;
continue;
}
}
System.out.print(s.charAt(i));
l=0;
}
scan.close();
}
}