#include <iostream>

using namespace std;

typedef long long Long;

Long extgcd(Long a, Long b, Long& x, Long& y) {
    Long g = a; x = 1LL; y = 0LL;
    if (b != 0LL) {
        g = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }
    return g;
}

int main() {
    int a, b; cin >> a >> b;
    Long x, y; extgcd(a, b, x, y);
    cout << x << " " << y << endl;
    return 0;
}