#include <bits/stdc++.h>
using namespace std;
long long a, m, b[10000005];
int main() {
  cin >> a >> m;
  for (int i = 1; i <= m; i++) {
    if (a % m == 0) {
      cout << "Yes" << endl;
      return 0;
    }
    b[a % m]++;
    if (b[a % m] == 2) {
      cout << "No" << endl;
      return 0;
    }
    a += a % m;
  }
  cout << "No" << endl;
}
