def xgcd(a,b)
  px = 1
  x = 0
  py = 0
  y = 1
  while b > 0
    q = a/b
    x, px = px - q*x, x
    y, py = py - q*y, y
    a, b = b, a%b
  end
  puts "#{px} #{py}"
end

a, b = gets.split(" ").map(&:to_i)
xgcd(a, b)

