xxx, yy = [int(i) for i in input().split()] for i in range(0, xxx + 1): if 2*i + 4*(xxx - i) == yy: print(i, xxx - i) break