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

LL GCD(LL a, LL b, LL& x, LL& y) {
	if (b == 0) {
		x = 1; y = 0;
		return a;
	}
	LL d = GCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

int main() {
	LL a1, a2;
	int x, y; cin >> x >> y;
	GCD(x, y, a1, a2);
	cout << a1 << " " << a2 << endl;
}
