#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-8;
const long long mod = (long long)1e9 + 7;
const unsigned long long mx = 133333331;
inline void RI(int &x) {
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0';
}
int flag[100005];
int main() {
  int a, m;
  while (~scanf("%d%d", &a, &m)) {
    memset(flag, 0, sizeof(flag));
    int t = 0;
    while (1) {
      a = a % m;
      if (flag[a] && a != 0) {
        t = 1;
        break;
      }
      if (a == 0) break;
      if (!flag[a]) flag[a] = 1;
      a *= 2;
    }
    if (t)
      printf("No\n");
    else
      printf("Yes\n");
  }
  return 0;
}
