#include using namespace std; int main(){ int N,H; cin>>N>>H; long long temp=1; long long res=1; for(int i=0;i>temp; res*=temp; res%=H; } if(res==0){ cout<<"YES"<