#include <bits/stdc++.h>
using namespace std;
bool fun(int m) {
  while (m) {
    if (m == 1) break;
    if (m % 2 != 0) return 0;
    m /= 2;
  }
  return 1;
}
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  return b == 0 ? a : gcd(b, a % b);
}
int main() {
  int a, m;
  scanf("%d%d", &a, &m);
  int flag = 0;
  if (a % m == 0)
    flag = 1;
  else
    m /= gcd(a, m);
  if (fun(m)) flag = 1;
  if (flag)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
