#include <bits/stdc++.h>
using namespace std;
inline void fastread(int *a) {
  register char c = 0;
  while (c < 33) c = getchar();
  *a = 0;
  while (c > 33) {
    *a = *a * 10 + c - '0';
    c = getchar();
  }
}
int binary_search(int *a, int x, int l, int r) {
  if (l > r) return -1;
  int p = l + (r - l) / 2;
  if (a[p] == x) return p;
  if (a[p] > x)
    return binary_search(a, x, l, p - 1);
  else
    return binary_search(a, x, p + 1, r);
}
int b[100001] = {0};
int main() {
  ios_base::sync_with_stdio(0);
  int a, m;
  cin >> a >> m;
  while (a % m != 0 && b[a % m] == 0) {
    b[a % m] = 1;
    a += a % m;
  }
  if (a % m == 0)
    cout << "Yes\n";
  else
    cout << "No\n";
}
