#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

typedef pair<int,int> pii;
typedef pair<int,pii> piii;

piii extgcd(int a,int b){
  if(b==0)return a>0?piii(a,pii(1,0)):piii(-a,pii(-1,0));
  piii res=extgcd(b,a%b);
  int x=res.second.first,y=res.second.second;
  return piii(res.first,pii(y,x-a/b*y));
}

int main(void){

  int a,b;

  cin >> a >> b;

  piii res=extgcd(a,b);
  cout << res.second.first << " " << res.second.second << endl;

  return 0;
}