#include <bits/stdc++.h>
using namespace std;
string a;
int k;
int f(int p, int x) {
  int m = 0, i, q;
  int n = a.size();
  for (i = p; i <= p + x; i++) {
    if (i == n) break;
    if (a[i] - '0' > m) {
      m = a[i] - '0';
      q = i;
    }
  }
  return q;
}
int main(void) {
  cin >> a >> k;
  if (a.size() == 1)
    cout << a << endl;
  else {
    int p = 0, i;
    while (k > 0) {
      for (i = f(p, k); i >= p + 1; i--) {
        swap(a[i], a[i - 1]);
        k--;
      }
      p++;
      int n = a.size();
      if (p == n - 1) break;
    }
    cout << a << endl;
  }
  return 0;
}
