#include <iostream>
using namespace std;
int n, k, len = 0;
bool pan[10000001] = { 0 };
int ans[10000001] = { 0 };
void find(int now)
{
    int next = now;
    while (now > 0) {
        next += now % 10;
        now /= 10;
    }
    if (next <= n&&pan[next]!=1) {
        pan[next] = 1;
        find(next);
    }
}
void doit()
{
    for (int i = 1; i <= n; i++) {
        if (pan[i] == 0) {
            len++;
            ans[len] = i;
            find(i);
        }
    }
}
int main()
{
    cin >> n >> k;
    doit();
    cout << len << endl;
    // for (int i = 1; i <=len; i++) {
    //     cout << " " << ans[i];
    // }
    // cout<<"--------------";
    int u;
    cin >> u;
    cout << ans[u];
    for (int i = 1; i < k; i++) {
        int u;
        cin >> u;
        cout << " " << ans[u];
    }
}