#include <bits/stdc++.h>
using namespace std;

void egcd(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return;
    }
    egcd(b, a%b, y, x);
    y -= a / b * x;
}

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