S, a, d:string;
i, n, j, b:integer;
c:array[1..200] of integer;
begin
readln(s);
readln(n);
a:=copy(s, 1, n);
for i:=1 to n do
val(a[i], c[i]);
for i:=1 to n do
for j:=1 to n do
if c[i]b:=c[i]; c[i]:=c[j]; c[j]:=b; end;
for i:=1 to n do
str(c[i], d[i]);
s:=d;
writeln(s);
readln;
end.