import sys input = sys.stdin.readline N,M=map(int,input().split()) if N==1: print("NaN") exit() LIST=[0]*(10**7) LIST[0]=1 now=0 for i in range(1,5*10**6+1): while True: if (now+1)*(now+1)<=N*i*i: now+=1 else: break if now<10**7: LIST[now]=1 else: break count=0 for i in range(10**7): if LIST[i]==0: count+=1 if count==M: print(i) break