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