function main(input) {
  const args = input.split(' ');
  const N = args[0];
  const K = args[1];
  
  if (N % K === 0) {
    console.log(0);
  } else {
    console.log(1);
  }
}


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