#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, m;
  cin >> a >> m;
  long long int c = a;
  bool flag = 0;
  map<long long, bool> ma;
  while (1) {
    ma[c % m] = 1;
    c += c % m;
    if (c % m == 0) {
      flag = 1;
      break;
    } else if (ma.count(c % m) > 0)
      break;
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
