#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <cstdlib>
using namespace std;
const long long mod=9973;
long long gcd(long long a,long long b){
if(!b) return a;
return gcd(b,a%b);
}
void exgcd(long long a,long long &x,long long b,long long &y){
if(!b){
x=1;
y=0;
}
else{
exgcd(b,y,a%b,x);
y-=x*(a/b);
}
}
int main(){
long long t,A,B,x,y;
while(cin>>A>>B){
if(gcd(A,B)!=1)
cout<<"sorry"<<endl;
else{
exgcd(A,x,B,y);
while(x<0) {x+=B;y-=A;}
cout<<x<<' '<<y<<endl;
}
}
return 0;
}