{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [n, k] <- map readInt . BS.words <$> BS.getLine
  print $ solve n k

solve :: Int -> Int -> Int
solve n k = if n `mod` k == 0 then 0 else 1

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt
