run time error !!! please check
hey @mohit_99, consider the case when K>N, your code missing that logic.