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