Kth element from last in linked list

Question LInk: https://hack.codingblocks.com/contests/c/511/469

My Solution Link: https://ide.codingblocks.com/s/37950

In this program output i have to print the linked list when there is -1 but if i am taking this so -1 is counted in Linked List.
PLease see the code and tell what can i do??

If possible, then please correct it in the code & comment the correction so that i can understand the issue.

https://ide.codingblocks.com/s/38062

I have made changes in your code. You can refer this.
You need to ad numbers only till -1 is not encountered, and don’t add -1 to the list.