import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    var num = StdIn.readLine().split(" ").map(a => a.toInt)
    val N = num(0)
    val K = num(1)
    val result = if( N % K == 0 ) 0 else 1

    println(result)
  }
}