#include <bits/stdc++.h>
using namespace std;
string s;
int n, tmp;
int main()
{
    ifstream f1("xaumax.inp");
    ofstream f2("xaumax.out");
    f1 >> s >> n;
    for (int i = 0; i < s.length(); i++)
        if (!(s[i] >= '0' && s[i] <= '9'))
        {
            s.erase(i, 1);
            i--;
            n--;
        }
    while (n > 0)
    {
        tmp = s.length();
        for (int i = 1; i < s.length(); i++)
            if (s[i - 1] < s[i] && n > 0)
            {
                s.erase(i - 1, 1);
                n--;
                break;
            }
        if (tmp == s.length() && n > 0)
        {
            s.erase(s.length() - n, n);
            break;
        }
    }
    f2 << s;
}
