func main() var n: int :: cui@inputInt() var k: int :: cui@inputInt() var ans: int :: 0 if(k <> 1) if(n = k) do ans :: 1 else do ans :: (n - k) * 2 end if end if do cui@print("\{ans}\n") end func