#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;
	getline (cin,s);
	cin>>k;
	while (c<s.length())
	{	if (chuso(s[c])=='1') c++;
		if (chuso(s[c])=='2') {s.erase(c,c+1);k--;}
	}
	while (k>0&&b<=s.length())
	{if (s[b]<s[b+1]) 
		{s.erase(b,b+1);
		k--;
		}
	else b++;
		
	}
	cout << s;
}

