#include <stdio.h>
bool Judge(int z[], int num){ // 判断数组z所存的数是否为回文数字,num为位数
for (int i=0; i<=num/2; i++){
if(z[i] != z[num-1-i]){
return false;
}
}
return true;
}
int main(){
int n,b,z[40], num = 0;
scanf("%d%d", &n, &b);
do{
z[num++] = n%b;
n /= b;
}while(n != 0);
bool flag = Judge(z, num);
if (flag == true){
printf("Yes
");
}else{
printf("No
");
}
for (int i=num-1; i>=0; i--){
printf("%d", z[i]);
if (i != 0) printf(" ");
}
}