#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int a, m;
  cin >> a >> m;
  a = a % m;
  while (m % 2 == 0) {
    m = m / 2;
  }
  if (a % m == 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
