'use strict';

function Main(input) {
  const N = Number(input.split(' ')[0]);
  const K = Number(input.split(' ')[1]);

  if(N % K === 0) {
    console.log(0);
  } else {
    console.log(1);
  }

};

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