#include <bits/stdc++.h>
using namespace std;
char chuso(char s)
{
	if (48<= (static_cast <int> (s) ) &&(static_cast <int> (s) )<=57)
	s='1'; else s = '2';
	return s;
}
	int main ()
{
	freopen ("xaumax.inp","r",stdin);
	freopen ("xaumax.out","w",stdout);
	string s;
	int b=0,c=0,d,e,f,k,a[1000];
	getline (cin,s);
	cin>>k;
	while (c<s.length())
	{	if (chuso(s[c])=='2')  k--;
		if (chuso(s[c])=='1') {a[b]= (static_cast <int> (s[c]))-48; b++;}
		c++;
	}
		for (e=0; e<b; e++)
	{
	if (a[e]<a[e+1]) {a[e]=-1;; k--;}
	if (k==0) break;
	}
	for (f=0; f<b; f++)
	if (a[f]!=-1) cout << a[f];
}

