from math import sqrt def calc(num,n): for i in range(n): num = sqrt(num) return num n,Z = map(int,input().split()) ans = "No" for i in range(1,Z): yn = Z**n - i**n c = calc(yn,n) if c == int(c): ans = "Yes" print(ans)