import math a, b = map(int, input().split()) r = math.sqrt(a) + math.sqrt(b) res = math.ceil(r) # try res - 1 # a + b + math.sqrt(a * b) = res while ((res - 1) ** 2 - a - b) ** 2 > 4 * a * b: res -= 1 print(res)