n,z=map(int,input().split()) if n==1: print("Yes") else: a=0 for x in range(1,30): if x>=z: break for y in range(1,30): if y>=z: break a+=x**n+y**n==z**n print(["No","Yes"][a>0])