from math import isqrt n, m = map(int, input().split()) if n == 1: print('NaN') exit() def f(x): # t*sqrt(n) - 1 < x # t^2 < (x+1)^2 / n tmx = isqrt(max(0, ((x+1) ** 2 + n - 1) // n - 1)) return x - tmx >= m l = 0 r = 1 while not f(r): l = r r *= 2 while r - l > 1: c = (l + r) // 2 if f(c): r = c else: l = c print(r)