#include <bits/stdc++.h>
using namespace std;

int EX_GCD(int a, int b, int& x, int& y) {
	int d = a;
	if (b != 0) {
		d = EX_GCD(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main()
{
	int a, b, x, y;
	cin >> a >> b;
	EX_GCD(a, b, x, y);
	cout << x << ' ' << y << endl;
	return 0;
}