#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
int main() {
  long long int a, m, flag = 0, hash[100005], i, j;
  cin >> a >> m;
  for (i = 0; i < m; i++) hash[i] = 0;
  while (1) {
    if (a % m == 0) {
      flag = 1;
      break;
    } else {
      if (hash[(a % m)] == 0)
        hash[a % m] = 1;
      else
        break;
    }
    a += a % m;
  }
  if (flag == 1)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
