import itertools N, Z = map(int, input().split()) if N == 1: print('Yes' if Z >= 2 else 'No') elif N == 2: Z2 = Z ** 2 for x, y in itertools.combinations_with_replacement(range(1, 10 ** 3 + 1), 2): if x ** N + y ** N == Z2: print('Yes') break else: print('No') else: print('No')