#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int maxn = 100010;
const double eps = 1e-8;
const int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
const int mod = 1000000007;
const int inf = 0x3fffffff;
const double pi = acos(-1.0);
int n, m, vis[maxn];
int main() {
  scanf("%d %d", &n, &m);
  while (true) {
    if (n == 0) {
      printf("Yes\n");
      break;
    }
    if (vis[n] == 1) {
      printf("No\n");
      break;
    }
    vis[n] = 1;
    n = (n + n) % m;
  }
}
