#include <iostream>

// // 再帰
// /// Solve the problem: ax + by = gcd(a, b)
// int extgcd(int a, int b, long long &x, long long &y) {
//   if (a == 0) {
//     x = 0;
//     y = 1;
//     return b;
//   }
//   long long x_, y_;
//   int gcd = extgcd(b % a, a, x_, y_);
//   x = y_ - (b / a) * x_;
//   y = x_;
//   return gcd;
// }

// 非再帰
/// Solve the problem: ax + by = gcd(a, b)
int extgcd(int a, int b, long long &x, long long &y) {
  int r1 = b;
  int r2 = a;
  long long x1 = 0, y1 = 1; // a * x1 + b * y1 = r1
  long long x2 = 1, y2 = 0; // a * x2 + b * y2 = r2
  while (r2) {
    int r3 = r1 % r2;             // r1 = q * r2 + r3
    long long x3 = x1 - (r1 / r2) * x2; // x3 = x1 - q * x2
    long long y3 = y1 - (r1 / r2) * y2; // y3 = y1 - q * y2
    r1 = r2;
    r2 = r3;
    x1 = x2, y1 = y2;
    x2 = x3, y2 = y3;
  }
  x = x1, y = y1;
  return r1;
}

int main() {
  int a, b;
  std::cin >> a >> b;
  long long x, y;
  extgcd(a, b, x, y);
  if (a == b)
    std::swap(x, y);
  std::cout << x << " " << y << std::endl;
}

