RADGEE Question WA

Question → CodeChef: Practical coding for everyone
In the above question it is mentioned “The game continues on until all cards are discarded”. What will happen for the case when M>N .

My solution–> Nov 18, 2022 - Codeshare

It is giving WA . Can someone tell me the reason ?