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