n,z = map(int, input().split()) S = set() i = 1 while i**n <= 10**6: S.add(i**n) i += 1 Z = z**n L = list(S) for X in L: Y = Z-X if Y in S: print('Yes') exit() else: print('No')