import scala.io.Source.stdin

object Main {

  def euclid(m:Int, n:Int):(Int, Int) = {
    if(m==0) {
      (0,1)
    } else {
      val (x,y) = euclid(n%m,m)
      if(x*m+y*n == x*n+y*m) {
        if(y-(n/m)*x < x)
          (y-(n/m)*x, x)
        else
          (x, y-(n/m)*x)
      } else {
        (y-(n/m)*x, x)
      }
    }
  }
  def main(args:Array[String]) =
    stdin.getLines.foreach { s=>
      val n = s.split(" ").map(_.toInt)
      val (x,y) = euclid(n(0),n(1))
      println(x+" "+y)
    }
}