{-# OPTIONS_GHC -Wall #-}

import Text.Printf

readInt :: String -> Int
readInt = read

-- g=gcd(a,b), および ax+by=g の特殊解を (g,x0,y0) の形で返す
extgcd :: Int -> Int -> (Int,Int,Int)
extgcd a b = fst $ f ((a,1,0),(b,0,1))
    where
        f (tup0,tup1@(0,_,_)) = (tup0,tup1)
        f ((r0,s0,t0),(r1,s1,t1)) = f ((r1,s1,t1),(r2,s2,t2))
            where
                (q1,r2) = r0 `divMod` r1
                s2 = s0 - q1*s1
                t2 = t0 - q1*t1

main :: IO ()
main = do
    [a,b] <- fmap (map readInt . words) getLine

    let (_,x0,y0) = extgcd a b

    printf "%d %d\n" x0 y0

