#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, m;
  bool stop = 0;
  cin >> a >> m;
  map<long long, long long> m1;
  while (true) {
    long long x = a % m;
    if (x == 0) {
      stop = 1;
      break;
    }
    if (m1[x] == 1) {
      break;
    }
    m1[x] = 1;
    a += x;
  }
  if (stop) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
