#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

// g = gcd(a, b), (x, y) satisfies ax + by = gcd(a, b)
template <typename T>
T extgcd(T a, T b, T &x, T &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    T d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}

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