#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long read() {
  long long f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 3) + (x << 1) + s - '0';
    s = getchar();
  }
  return x * f;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
  return;
}
string str[2000005];
long long n;
map<string, int> m;
int main() {
  int a, m;
  scanf("%d %d", &a, &m);
  for (int i = 0; i <= m; i++) {
    if (a % m == 0) {
      puts("Yes");
      return 0;
    }
    a += a % m;
    a %= m;
  }
  puts("No");
  return 0;
}
