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] if len(P) > 1 else 0, P[0])