(defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (k (read))) (format t "~d~%" (cond ((or (<= k 0) (> k n)) 0) ((evenp n) (- n 2)) (t (if (= k (floor (1+ n) 2)) (- n 1) (- n 2))))))) (main)