A,B = map(int,input().split())
dived = [0]*(B+1)
dived[B] = A
for i in range(B-1):
	x = dived[B-i]
	dived[B-i] = 0
	dived[B-i-1] -= x
	dived[B-i-2] -= x

print(dived[1],dived[0])