function Main(input){
	input = input.split(" ");
	nums = input.map(input=>parseInt(input,10));
    ans = nums[0] % nums[1];
    if(ans != 0){
    console.log(1);
    }else{
    console.log(0);
    }
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));