#include<iostream>
#include<math.h>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<vector>
using namespace std;
#define INF 100000000
#define maxn 100010
int store[maxn];
int num,base;
int main()
{ cin>>num>>base;
if(num==0) {cout<<"Yes"<<endl;
cout<<"0";
return 0; }
int i=0;
while(num){
store[i++]=num%base;
num=num/base;
}
bool flag=true;
int j=0;
int num=i-1;
for(i--;i>=j;i--,j++)
{
if(store[i]!=store[j]) {
flag=false;
break;
}}
if(flag) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
#include<math.h>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<vector>
using namespace std;
#define INF 100000000
#define maxn 100010
int store[maxn];
int num,base;
int main()
{ cin>>num>>base;
if(num==0) {cout<<"Yes"<<endl;
cout<<"0";
return 0; }
int i=0;
while(num){
store[i++]=num%base;
num=num/base;
}
bool flag=true;
int j=0;
int num=i-1;
for(i--;i>=j;i--,j++)
{
if(store[i]!=store[j]) {
flag=false;
break;
}}
if(flag) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
for(int k=num;k>=0;k--){
cout<<store[k];
if(k>0) cout<<" ";}
return 0;
}
if(k>0) cout<<" ";}
return 0;
}