#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
int mark[1000006];
int main() {
  ios_base::sync_with_stdio(false);
  long long a, m, tt;
  cin >> a >> m;
  tt = a;
  while (1) {
    if (tt % m == 0) {
      cout << "Yes" << endl;
      return 0;
    } else if (mark[tt % m] == 1) {
      cout << "No" << endl;
      return 0;
    }
    mark[tt % m] = 1;
    tt = tt + (tt % m);
  }
  return 0;
}
