{-# OPTIONS_GHC -Wall #-}

readInt :: String -> Int
readInt = read

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

main :: IO ()
main = do
    [n,k] <- fmap (map readInt . words) getLine

    let ans = solve n k

    print ans
