n, z = map(int, input().split()) z = z ** n vs = set() for x in range(1, 10**6+1): x = x**n if x > z: print("No") break vs.add(x) # print(z-x, vs) if z-x in vs: print("Yes") break