#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

int main(){
   int M,H;
   cin >> M >> H;
   if(H%M == 0) cout << "Yes" << endl;
   else cout << "No" << endl;
}
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define endl '\n'

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;

int g(string a)
{
	int t=0;
	for(int i=0;i<a.size();i++)
	{
		t=t*10+a[i]-'0';
	}
	return t;
}

int f(int x)
{
	string s;
	while(x)
	{
		s+=x%10+'0';
		x/=10;
	}
	sort(s.begin(),s.end());
	int ans1=g(s);
	reverse(s.begin(),s.end());
	int ans2=g(s);
	return ans2-ans1;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,k;
	cin>>n>>k;
	int res=n;
	for(int i=1;i<=k;i++)
	{
		res=f(res);
	}
	cout<<res<<endl;
	
	return 0;
}


