#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, m;
  cin >> a >> m;
  a %= m;
  map<int, bool> vis;
  while (!vis[a]) {
    vis[a] = true;
    if (!a) {
      cout << "Yes\n";
      return 0;
    }
    a *= 2;
    a %= m;
  }
  cout << "No\n";
  return 0;
}
