{  ACM International Collegiate Programming Contest
   Central European Regional Contest 2000
   
   Problem C - Complete the sequence!
   Martin Kacer
}
   
Program Dopln;
Const MAX_NUMS = 128;
Var TaskCnt, TaskNum : Integer;
	NumCnt, NumNext	 : Integer;
	I, J			 : Integer;
	Difs			 : Array [1..MAX_NUMS, 1..MAX_NUMS] of Integer;
Begin
	Readln (TaskCnt);
	For TaskNum:= 1 to TaskCnt do
	Begin
		ReadLn (NumCnt, NumNext);
		For I:= 1 to NumCnt do Read (Difs[1,I]);
		ReadLn;

		If (NumCnt > 1) then For I:= 2 to NumCnt do
			For J:= 1 to NumCnt-I+1 do
				Difs[I,J]:= Difs[I-1,J+1] - Difs[I-1,J];
		For I:= 1 to NumNext do
		Begin
			Difs[NumCnt,1+I]:= Difs[NumCnt,1];
			if (NumCnt > 1) then For J:= NumCnt-1 downto 1 do
				Difs[J,NumCnt-J+I+1]:= Difs[J,NumCnt-J+I]
						+ Difs[J+1,NumCnt-J+I];
		End;
		For I:= 1 to NumNext do
		Begin
			if (I > 1) then Write (' ');
			Write (Difs[1,NumCnt+I]);
		End;
		WriteLn;
	End;
End.
