What is wrong here


please help in debbuging

In the question, there is only two thing which we take to input.
n
a1, a2, … an
Why are taking input k? What is the use. May be you read the question wrong. Please read it one more time.
If you want any help in reference, take the help of google. This is very standard question. Or you will ask with me also.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.