#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int x, y;
while (cin >> x >> y,x+y) {
x *= 100;
bool flag = 0;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
int m = x;
m+= 10 * i + j;
if (m%y == 0) {
cout << i << j << " ";
}
}
}
cout << endl;
}
return 0;
}