n,z=map(int,input().split()) a=0 if n == 1: if z==1: print('No') else: print('Yes') elif n == 2: for x in range(1,10**4): for y in range(x,10**4): if x ** n + y ** n == z ** n: a+=1 break elif x ** n + y ** n > z ** n: break if a > 0: print('Yes') else: print('No') elif n == 3: print('No')