#include <bits/stdc++.h>
const int maxn = 1e5 + 5;
int vis[maxn] = {0};
int main() {
  int a, m;
  scanf("%d%d", &a, &m);
  a %= m;
  while (a && !vis[a]) {
    vis[a] = 1;
    a += a % m;
    a %= m;
  }
  if (a) {
    printf("No\n");
  } else
    printf("Yes\n");
}
