import sys n,z = map(int,input().split()) if n >= 3: print('No') sys.exit() f = False for i in range(1,z+1): for j in range(1,z+1): if i**n+j**n == z: f = True break if f: print('Yes') else: print('No')