n, z = map(int, input().split()) t = z**n s = set() x = 1 while x**n<=t: s.add(x**n) x += 1 for si in s: if t-si in s: print('Yes') exit() print('No')