#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
//by NeighThorn
using namespace std;
inline int ex_gcd(int a,int b,int &x,int &y){
	if(b==0)
		return x=1,y=0,a;
	int lala=ex_gcd(b,a%b,x,y),tmp=x;
	x=y;y=tmp-a/b*y;
	return lala;
}
signed main(void){
	int a,b,x,y;scanf("%d%d",&a,&b);
	ex_gcd(a,b,x,y);cout<<x<<" "<<y<<endl;
	return 0;
}