why CHFQUEUE -WA?

i have tested a lot of cases on my system and i m gettin right answer…bt i m getting WA for my solution on submission plz help… following is the link to my solution http://www.codechef.com/viewsolution/5578916
the problem link is http://www.codechef.com/problems/CHFQUEUE

Heading #### Your code gives wrong answer for large values of N and K .

correct code output

your code output