#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long

ll a, b;


int main(){
  cin >> a >> b;
  ll x1 = 1, y1= 0, x2 = 0, y2 = 1;
  while(1){
    if(x2 * a + y2 * b == 0)
      break;
    ll div = (x1 * a + y1 * b) / (x2 * a + y2 * b);
    ll tempx = x2;
    ll tempy = y2;
    x2 = x1 - x2 * div;
    y2 = y1 - y2 * div;
    x1 = tempx;
    y1 = tempy;
  }
  cout << x1 << ' ' << y1 << endl;
}