n,z=map(int, input().split()) if z==1: print('No') exit() D=[] for i in range(1,1001): d=i**n if d>10**6 or d>z**n: break D.append(d) Z=z**n a=len(D) for i in D: if Z-i in D: print('Yes') exit() print('No')