import Control.Applicative main :: IO() main = do [ s, k ] <- map (read :: String -> Int) . words <$> getLine let cww = mod s k print $ cww