#include <bits/stdc++.h>
using namespace std;
int a,b;
int x,y,d;
int exgcd(int a,int b,int& x,int& y){
if(b==0) {x=1,y=0; return a;}
int d=exgcd(b,a%b,x,y);
int z=x; x=y; y=z-y*(a/b);
return d;
}
int main(){
// ios::sync_with_stdio(0);
freopen("1.in","r",stdin);
freopen("1.out","w",stdout);
// ==============================================================
cin>>a>>b;
d=exgcd(a,b,x,y);
printf("x=%d\ny=%d\ngcd(x,y)=%d",x,y,d);
// ==============================================================
end:
return 0;
}