#include <bits/stdc++.h>
void dout() { printf("\n"); }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {}
template <typename T>
std::string toString(T val) {
  std::ostringstream oss;
  oss << val;
  return oss.str();
}
template <typename T>
T fromString(const std::string& s) {
  std::istringstream iss(s);
  T res;
  iss >> res;
  return res;
}
using namespace std;
int main() {
  int a, m;
  scanf("%d", &a);
  scanf("%d", &m);
  set<int> pred;
  int x = a;
  while (x % m != 0) {
    int b = x % m;
    x += b;
    if (pred.find(b) != pred.end()) break;
    pred.insert(b);
  }
  if (x % m == 0)
    printf("Yes");
  else
    printf("No");
  return 0;
}
