Var
n,k,i,i2,zn,zn2:integer;
a:array[1..100] of integer;
Begin
Readln(n,k);
for i:=1 to n do Read(a[i]);
zn:=a[1];
for i2:=1 to k do begin
a[1]:=a[n];
for i:=2 to n+1 do
if i<>n+1 then begin zn2:=a[i]; a[i]:=zn; zn:=zn2; end;
End;
for i:=1 to n do Write(a[i],' ');
End.