#include <bits/stdc++.h>
int main() {
  long long int a, m, mod, t, i;
  int vis[100000];
  scanf("%I64d", &a);
  scanf("%I64d", &m);
  for (i = 0; i < m; i++) vis[i] = 0;
  mod = a % m;
  while (mod != 0 && vis[mod] == 0) {
    vis[mod] = 1;
    a = a + mod;
    mod = a % m;
  }
  if (mod == 0)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
