const main = input => {
  const [N, K] = input.trim().split(' ').map(x => parseInt(x))
  const ans = N % K === 0 ? 0 : 1
  console.log(ans)
}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"));
