#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> S;
  int a, m;
  cin >> a >> m;
  int k = a % m;
  S.insert(k);
  bool stop = true;
  while (k != 0) {
    int i = k;
    while (i < m) i *= 2;
    k = i % m;
    if (S.count(k)) {
      stop = false;
      break;
    } else {
      S.insert(k);
    }
  }
  if (stop)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
