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