def extgcd(a, b)
    x, y = 1, 0
    g, e = 1, 0
    while b != 0
        q, r = a/b, a%b
        m = x-q*e
        n = y-q*g
        a, b = b, r
        x, e = e, m
        y, g = g, n
    end
    return [x, y, g]
end

a, b = gets.chomp.split.map(&:to_i)
x, y, g = extgcd(a, b)

puts( [x, y].join(" ") )


