#include <iostream>
#include <vector>

void ext_gcd(uint32_t a, uint32_t b, std::pair<int32_t, int32_t>& ans) {
  if (b == 0) {
    ans.first = 1;
    ans.second = 0;
    return;
  }
  ext_gcd(b, a % b, ans);

  int32_t temp = ans.first;
  ans.first = ans.second;
  ans.second = temp - (a / b) * ans.second;
  return;
}

int main() {
  uint32_t a = 0, b = 0;
  std::cin >> a >> b;

  std::pair<int32_t, int32_t> ans;
  ext_gcd(a, b, ans);

  std::cout << ans.first << " " << ans.second << std::endl;

  return 0;
}
