import Control.Applicative ((<$>))

fi = fromIntegral

main :: IO ()
main = do
  [n,k] <- map read . words <$> getLine :: IO [Int]
  print $ if min (ceiling (fi n/fi k)*k-n) (n-(n`div`k)*k) > 0
    then 1
    else 0