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