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