#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long 
#define pb(e) push_back(e)
#define sv(a) sort(a.begin(),a.end())a
#define sa(a,n) sort(a,a+n)
#define mp(a,b) make_pair(a,b)
#define vf first
#define vs second
#define ar array
const int inf = 0x3f3f3f3f;
int mod = 1000000007; 
bool remender(ll a , ll b){return a%b;}

void solve(){
	int m , h;
	cin>>m>>h;
	cout<<(h % m != 0 ? "No\n" : "Yes\n");
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
	//int t;cin >> t;while(t--)
	solve();
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll X, Y;
map<ll, ll> mp;

ll solve(ll y) {
	if (mp.count(y) > 0) return mp[y];
	if (y == 1) {
		mp[y] = abs(X-y);
	} else if (y%2 == 1) {
		mp[y] = min(min(abs(X-y), solve((y+1)/2)+2), solve((y-1)/2)+2);
	} else {
		mp[y] = min(abs(X-y), solve(y/2)+1);
	}
	return mp[y];
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> X >> Y;
	cout << solve(Y) << "\n";
}