var i, j, n, k, tmp: longint;
	a: array[1..200000] of longint;
begin
	reset(input, 'battle.in');
	rewrite(output, 'battle.out');
	read(n, k);
	if (n > 2000) then halt(1);
	for i := 1 to n do
		read(a[i]);
	for i := 1 to k do
		for j := 1 to n - 1 do
			if (a[j + 1] < a[j]) then begin
				tmp := a[j + 1];
				a[j + 1] := a[j];
				a[j] := tmp;
			end;

	for i := 1 to n do
		write(a[i], ' ');
end.
