#include<cstdio>
#include<iostream>
#include<omp.h>
const int pow_matrix[10][10] = {
{1,1,1,1,1,1,1,1,1,1},
{0,1,2,3,4,5,6,7,8,9},
{0,1,4,9,16,25,36,49,64,81},
{0,1,8,27,64,125,216,343,512,729},
{0,1,16,81,256,625,1296,2401,4096,6561},
{0,1,32,243,1024,3125,7776,16807,32768,59049},
{0,1,64,729,4096,15625,46656,117649,262144,531441},
{0,1,128,2187,16384,78125,279936,823543,2097152,4782969},
{0,1,256,6561,65536,390625,1679616,5764801,16777216,43046721},
{0,1,512,19683,262144,1953125,10077696,40353607,134217728,387420489},
};
inline long get()
{
int c = getchar();
long res = c - '0';
while ((c = getchar()) >= '0' && c <= '9')
res = res * 10 + c - '0';
return res;
}
int main()
{
long num = get(), i = 1, j = 1;
int x = get(), k = 1, sum = 0;
std::cout << num << std::endl;
std::cout << x << std::endl;
#pragma omp parallel for
for (i = 1; i <= num; ++i)
{
j = i;
sum = 0;
while (j > 0)
{
k = j % 10;
j /= 10;
sum += pow_matrix[x][k];
}
if (sum == i)
{
std::cout << sum << std::endl;
}
}
return 0;
}
06-08
3311

05-09
1391

03-14
1180

07-07
895

05-19