
var
n,g,l,z, t,i,j,x,k,c: longint;
m: array [1..1000] of longint;
begin
while i<=t do begin
read(n,g);
for i:=1 to n do begin read (m[i]);
for j:=n downto 2  do begin
x:=1;
for l:=1 to j do
if m[x] < m[l] then x:=1;
k:=m[x];
m[x]:=m[j];
m[j]:=t;
end;
for z:=n to n-g do begin
c:=c+ m[z];
end;
write (c,' ');
c:=0;1

dec(t);
end;
end;
end.
