defmodule Main do
  def main do
	[n, k] = IO.read(:line)
      |> String.trim()
      |> String.split()
      |> Enum.map(&String.to_integer/1)
      ans = if rem(n,k) === 0 do
    	0
      else
        1
      end
	IO.puts ans
  end
end
