A, B = map(int, input().split()) P = [0] * B + [A] while len(P) > 2: a = P.pop() P[-1] -= a P[-2] -= a print(P[1], P[0])