Lisp Perm Missing Element
(defun perm-missing-element (a)
  (let* ((sorted (sort (copy-list a) #'<))
         (vec (coerce sorted 'vector)))
    (loop for k from 0 below (length vec)
          do (when (/= (aref vec k) (1+ k))
               (return-from perm-missing-element (1+ k))))
    (1+ (length vec))))

This uses the expected sum of 1..N+1 and subtracts the actual sum to find the missing value.