Wrong test case
since after n appendings list achieves its initial state again, so after taking input k, replace it by k%n1
Corrected Code
since after n appendings list achieves its initial state again, so after taking input k, replace it by k%n1
Corrected Code