#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, m, n, t, x, a;
  cin >> a >> m;
  map<long long, long long> mym;
  long long rem = a % m;
  bool paisi = false;
  while (mym[rem] == 0) {
    mym[rem]++;
    a = a + rem;
    rem = a % m;
    if (rem == 0) {
      paisi = true;
      break;
    }
  }
  if (paisi)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
