def egcd(a, b, x0 = 1, x1 = 0, y0 = 0, y1 = 1)
  if b == 0
    return [x0, y0]
  else
    return egcd(b, a % b, x1, x0 - a / b * x1, y1, y0 - a / b * y1)
  end
end

a, b = gets.split.map(&:to_i)
puts egcd(a, b).join(" ")