#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  long long a, m;
  cin >> a >> m;
  bool b[m];
  for (int i = 0; i < m; i++) b[i] = 0;
  while (a % m != 0) {
    if (b[a % m] == 1) {
      cout << "No";
      break;
    } else
      b[a % m] = 1;
    a = a + a % m;
  }
  if (a % m == 0) cout << "Yes";
  return EXIT_SUCCESS;
}
