Euclidean algorithm
Run the extended Euclidean algorithm: