object Main extends App{
  override def main(args:Array[String])={
    var num = readLine.split(" ").map(a => a.toInt)
    var N = num(0)
    var K = num(1)
    if(N%K==0) println(0)
    else println(1)
  }
}