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

template<class T>
T extgcd(T a,T b,T &x,T &y){
	T d = a;x = 1;y = 0;
	if(b != 0){
		d = extgcd(b,a % b,y,x);
		y -= (a / b) * x;
	}
	return d;
}

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