#include <bits/stdc++.h>
using namespace std;
int a, m;
int main() {
  scanf("%d%d", &a, &m);
  int q = a % m;
  if (m % 2 == 0) {
    while (m % 2 == 0) m = m / 2;
  }
  if (q % 2 == 0 && q > 0) {
    while (q % 2 == 0) q = q / 2;
  }
  if (q % m == 0)
    printf("Yes\n");
  else
    printf("No\n");
}
