#include <bits/stdc++.h>
using namespace std;
int a, m, v[100001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> m;
  do {
    if (v[a]) {
      cout << "No"
           << "\n";
      return 0;
    }
    int r = a % m;
    v[a] = 1;
    a = (a + r) % m;
  } while (a % m);
  cout << "Yes"
       << "\n";
  return 0;
}
