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

template<class T> std::vector<T> zako_division(std::vector<T> &lhs, const std::vector<T> &rhs){
    std::vector<T> res(lhs.size() - rhs.size() + 1);
    int stop = rhs.size() - 1;
    for(int i = lhs.size() - 1; i >= stop; i--){
        res[i - stop] = lhs[i] / rhs.back();
        T cur = res[i - stop];
        for(int j = 0; j < rhs.size(); j++){
            lhs[i - j] -= rhs.rbegin()[j] * cur;
        }
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    vector<int> A(b + 1), B(3, 1);
    A[b] = a;
    zako_division(A, B);
    cout << A[1] << " " << A[0] << '\n';
}