In Such Problem how do we approach to find the value Of X as X can range between 2 to 2*K . Any help will be highly appreciated.

Thanks brother