Wrong Answer for k>=n

Could you please explain why my solution is giving WA for k>=n?

hello @Sayon-Palit-2873308702757758
replace k with k%n.