import           Control.Applicative
import           Control.Monad
import           Data.List
import           Text.Printf

extendedEu :: Integer -> Integer -> (Integer, Integer)
extendedEu a 0 = (1, 0)
extendedEu a b = (t, s - q * t)
  where
    (q, r) = quotRem a b
    (s, t) = extendedEu b r

lt::(Integer, Integer)->(Integer,Integer)->Bool
lt (x1,y1) (x2,y2) =
  let v1=abs x1 + abs y1
      v2=abs x2 + abs y2 in
      if v1==v2 then x1 <= y1 else v1 < v2

min'::(Integer, Integer)->(Integer,Integer)->(Integer,Integer)
min' a b
  | lt a b = a
  | otherwise = b

main = do
  [n,m]<- map (read::String->Integer) . words <$> getLine
  let (x0,y0) = extendedEu n m
  let d = n*x0 + m*y0
  -- k = -x0 .. y0
  -- x = x0 + k*m / d, y = y0- k*n/d
  let (x1,y1) = foldl min' (x0,y0) [(x0 + k*m `div` d, y0 - k* n `div` d)| k<-[(-x0)..y0]]
  putStrLn $ show x1 ++ " " ++ show y1
