#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
bool used[N + 1];
int main() {
  int a, m, now;
  cin >> a >> m;
  now = a;
  used[now] = 1;
  while (1) {
    if (now % m == 0) {
      cout << "Yes" << endl;
      return 0;
    }
    now = (now + (now % m)) % m;
    if (used[now]) {
      cout << "No" << endl;
      return 0;
    }
    used[now] = 1;
  }
  return 0;
}
