#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, m;
  cin >> a >> m;
  if (a % m == 0) {
    cout << "Yes";
    return 0;
  }
  a %= m;
  bool vis[m + 1];
  for (int i = 0; i <= m; i++) vis[i] = false;
  vis[a] = true;
  int temp = (a + a % m) % m;
  while (!vis[temp]) {
    if (temp % m == 0) {
      cout << "Yes";
      return 0;
    }
    vis[temp] = true;
    temp = temp + temp % m;
    temp = temp % m;
  }
  cout << "No";
  return 0;
}
