#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<string.h>

const int MAXN = 1000000000;
const int MOD = 1000000007;

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

int main() {
	int a, b;
	scanf("%d%d", &a, &b);
	int x, y;
	ext_gcd(a, b, x, y);
	printf("%d %d\n", x, y);

	return 0;
}
