n,z=map(int,input().split()) c=z**n if n==1: if z==1: print("NO") else: print("YES") else: for i in range(1,1001): for j in range(1,1001): if i**n+j**n==c: print("YES") exit() print("NO")