k = int(input())
e = int(input())
if (k+e)%3 == 0 and max(k,e)/2 <= min(k,e):
b=(k + e)//3
print(k-b, e-b)
else:
print(-1)