N,M=map(int,input().split()) a=0 if N<2:M,a=0,"NaN" s=N**0.5 while M: a+=1 m=int(a/s) M-=all(a!=int(i*s)for i in[m,m+1]) print(a)