#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;

struct info { ll x, y, g; };

//Solve ax + by = (a, b)
info ext_gcd(ll a, ll b)
{
	ll a0 = 1, a1 = 0, b0 = 0, b1 = 1, t;
	while (b != 0)
	{
		t = a0 - a / b * a1; a0 = a1; a1 = t;
		t = b0 - a / b * b1; b0 = b1; b1 = t;
		swap(a %= b, b);
	}
	if (a < 0)
	{
		a0 = -a0; b0 = -b0; a = -a;
	}
	return {a0, b0, a};
}


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int a, b;
	cin >> a >> b;

	info ans = ext_gcd(a, b);

	cout << ans.x << " " << ans.y << endl;

	return 0;
}