R,B = map(int,input().split()) l = 1 r = 2000000 while r - l > 1: k = (l + r) // 2 s = k*(k+1)*(2*k+1) // 6 RR,BB = R,B for kk in range(k,0,-1): if RR >= kk*kk: RR -= kk*kk s -= kk*kk if s <= BB: l = k else: r = k print(l)