import java.util.*;
public class Main {
private static void EuclidAlgorithm(int a, int b)
{
if (a < b)
{
EuclidAlgorithm(b, a);
int temp = ResultX;
ResultX = ResultY;
ResultY = temp;
return;
}
if (b == 0)
{
ResultX = 1;
ResultY = 0;
ResultGCD = a;
return;
}
int floor = a / b;
EuclidAlgorithm(b, a - b * floor);
int tempX = ResultX;
int tempY = ResultY;
ResultX = tempY;
ResultY = tempX - tempY * floor;
return;
}
private static void OutputEuclidNumbers(int a, int b)
{
EuclidAlgorithm(a, b);
System.out.println(ResultX + " " + ResultY + " " + ResultGCD);
}
public static void main(String[] args){
Scanner inScanner = new Scanner(System.in);
while(inScanner.hasNextInt())
{
int a = inScanner.nextInt();
int b = inScanner.nextInt();
OutputEuclidNumbers(a, b);
}
}
private static int ResultX;
private static int ResultY;
private static int ResultGCD;
}