import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines n, z = map(int, readline().split()) if n >= 3: print('No') quit() if n == 1: print('No' if z == 1 else 'Yes') quit() x = 1 while x ** n < z ** n: y = 1 while x ** n + y ** n <= z ** n: if x ** n + y ** n == z ** n: print('Yes') quit() y += 1 x += 1 print("No")