N,M=map(int,input().split()) if N==1: print('NaN') exit() l=1 r=10**20 from math import isqrt while True: if l==r: break m=(l+r)//2 k=isqrt(((m+1)**2-1)//N) count=m-k if count>=M: r=m else: l=m+1 print(l)