#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;

ll s,p;
int main(){
	scanf("%lld%lld",&s,&p);
	bool flag = 0;
	for(ll i = 1;i * i <= p;i++){
		if(p%i == 0){
			ll x = i,y = p/i;
			if(x + y == s) flag = 1;
		}
		if(flag) break;
	} 
	if(flag) puts("Yes");
	else puts("No");
	return 0;
}
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define ll long long 
#define pb push_back
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//typedef long long  MOD=1000000009;
ll MOD=998244353;
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
//ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll lcm(ll x, ll y) {ll res = (x * y) / __gcd(x, y); return res;}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}

void iofoj(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
#define F first
#define S second

map<ll,ll>mp;

ll ans(ll a,ll b)
{
    if(a>=b)return mp[b]=a-b;
    if(mp.find(b)!=mp.end())return mp[b];
    ll sum=b-a;
    if(b%2==0)
    {
        return mp[b]=min(sum,ans(a,b/2)+1);
    }
    return mp[b]=min(sum,min(ans(a,(b+1)/2),ans(a,(b-1)/2))+2);
}

void solution()
{
    ll k,i,j,m,w,n;
    ll a,b;
    cin>>a>>b;
    cout<<ans(a,b);
}

int main(){
    fio
    //iofoj();
    // ll t;
    // cin>>t;
    // for(ll i=1;i<=t;i++)
    solution();
    return 0; 
}
