main::IO() main = do l:k:[]<-fmap (fmap read . words) getLine print . (*k) $ l `div` (2*k) + if l `mod` (2*k) ==0 then (-1) else 0