import Control.Applicative
import Text.Printf

-- + gcd(a, b) = m * a + n * b を満たす (gcd(a, b), m, n) を計算する。
extendedEuclideanAlgorithm :: Integral a => a -> a -> (a, a, a)
extendedEuclideanAlgorithm a b = loop [(a, b), (1, 0), (0, 1)]
  where
    loop [(u1, 0), (u2, _), (u3, _)] = (u1, u2, u3)
    loop ls@((u1, v1) : _) = loop $ map (\(u, v) -> (v, u - (div u1 v1) * v)) ls

main :: IO ()
main = do
  [a, b] <- map (read :: String -> Int) . words <$> getLine
  let (_, x, y) = extendedEuclideanAlgorithm a b
  printf "%d %d\n" x y

