#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, m;
  cin >> a >> m;
  long long x = 1LL;
  while (x < m) {
    x = x * 2;
  }
  long long y = (x * a) % m;
  if (y == 0)
    cout << "Yes";
  else
    cout << "No";
}
