#include <bits/stdc++.h>
using namespace std;
const int mx = 100010;
int b[mx];
int main() {
  int a, m;
  while (scanf("%d%d", &a, &m) == 2) {
    memset(b, 0, sizeof b);
    while (a) {
      if (b[a]) break;
      b[a] = 1;
      a = (a + a) % m;
    }
    if (a)
      printf("No\n");
    else
      printf("Yes\n");
  }
}
