#include <bits/stdc++.h>
int main() {
  long long int a, p;
  int k, b = 1, i, j = 0, replace, bigger, where, x;
  scanf("%I64d %i", &a, &k);
  p = a;
  while (p / 10 > 0) {
    b++;
    p = p / 10;
  }
  int order[b];
  p = a;
  for (i = b - 1; i >= 0; i--) {
    order[i] = p % 10;
    p = p / 10;
  }
  while (k > 0 && j != b - 1) {
    bigger = 0;
    for (i = b - 1; i >= j; i--) {
      if (i - j <= k) {
        if (bigger <= order[i]) {
          bigger = order[i];
          where = i;
        }
      }
    }
    if (where - j <= k) {
      for (x = where; x > j; x--) {
        replace = order[x];
        order[x] = order[x - 1];
        order[x - 1] = replace;
        k--;
      }
    }
    j++;
  }
  for (i = 0; i < b; i++) {
    printf("%i", order[i]);
  }
}
