eval"N,K,*A="+gets(p).split*?, a,*b=A.sort p b.map{-a+a=_1}.min(N-K).sum