a, b = map(int, input().split()) print(a, b) if a > b: c = a - b + 2 * 10**9 - a - 1 elif a < b: c = a - 1 print(c)