(defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (k (read)) (a (sort (loop repeat n collect (read)) #'>)) (b (car a))) (loop for i from 1 below k when (>= (nth i a) 0) do (incf b (nth i a))) (format t "~d~%" b))) (main)