#include <bits/stdc++.h>

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

int extGCD( int a, int b, int& x, int& y ){
    if( b != 0 ){
        int d = extGCD( b, a % b, y, x );
        y -= a / b * x;
        return d;
    }else{
        x = 1, y = 0;
        return a;
    }
}

signed main(){
    int a, b; cin >> a >> b;
    int x, y;
    extGCD( a, b, x, y );
    cout << x << " " << y << endl;
}
