import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  [n, k] <- map (read::String -> Int) . words <$> getLine
  print $ if n `mod` k == 0 then 0 else 1
