'use strict'

function main(input) {
  input = input.split('\n')[0].split(' ').map(n => Number(n));
  
  const n = input[0];
  const k = input[1];
  const ans = (n % k === 0) ? 0 : 1;
  console.log(ans);
}

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