import sys input=sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 import bisect n,z=MI() t=pow(z,n) L=[] for i in range(1,t): temp=pow(i,n) if temp>t: break L.append(temp) L.append(10**9) flag=0 for xn in L: num=bisect.bisect_left(L,t-xn) if L[num]==t-xn: flag=1 if flag==1: print("Yes") else: print("No") main()