object Main {
    def main(args: Array[String]) {
        val factors = scala.io.StdIn.readLine().split(" ")

        if(factors(0).toInt%factors(1).toInt == 0) println("0")
        else                           println("1")
    }
}