import java.util.Scanner

fun main(args: Array<String>){
	val s = Scanner(System.`in`).nextLine()
	val sarr = s.split(" ")

	val N = Integer.parseInt(sarr[0])
	val K = Integer.parseInt(sarr[1])

	if(N%K == 0) println(0)
	else println(1)
}