I failed one portion of the KS exam. Do I have to retake both sections

No, you can just retake the portion of the exam that you failed. Keep in mind that you have to pass both sections of the exam within six months of your first testing attempt.