#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> fact(int n) {
  unordered_map<int, int> f;
  for (int d = 2; d * d <= n; ++d) {
    while (n % d == 0) {
      f[d]++;
      n /= d;
    }
  }
  if (n > 1) {
    f[n]++;
  }
  return f;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a, m;
  cin >> a >> m;
  unordered_map<int, int> fa = fact(a);
  unordered_map<int, int> fn = fact(m);
  bool onlytwo = true;
  for (auto it : fn) {
    if (it.second > fa[it.first] && it.first != 2) {
      onlytwo = false;
      break;
    }
  }
  cout << (onlytwo ? "Yes\n" : "No\n");
  return 0;
}
