#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

pair<long long,long long> extGCD(long long a,long long b){
  vector<long long> k;
  long long q;
  bool flag = 1;
  if(a < b)swap(a,b),flag = 0;
  while(b)k.push_back(a/b),q=a%b,a=b,b=q;
  long long x=0,y=1,u=1,v=-k[0],X,Y,U,V;
  for(long long i = 1;i < k.size();i++)X=x,Y=y,U=u,V=v,x=U,y=V,u=X-U*k[i],v=Y-V*k[i];
  if(flag)return make_pair(x,y);
  else return make_pair(y,x);
}

signed main(){
  ll a,b;
  cin >> a >> b;
  pair<ll,ll> p = extGCD(a,b);
  cout << p.first << ' ' << p.second << endl;
}
