Run time error!

PLEASE HELP ME REMOVE RUN TIME ERROR.

Hi @shubhamgh00, what should be the output for following testcase:

// Input
7
1 2 3 4 5 6 7
7

// Expected Output
1 2 3 4 5 6 7

// Your Output
–Runtime Error–

Pls check ur code for testcases where k will be greater than or equal to n .