The people who solved it. did you consider it? The sample does not say so.Input will be terminated with N=0 and K=0.
How to solve it? I'm getting TLE, but no reason to get it. it may be WA. Someone plz clarify whether it is just some math or anything other to solve it?