#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long k;
  cin >> k;
  long long n = s.size();
  long long dp[n][2][k + 1];
  for (int i = 0; i < ((int)n); i++)
    for (int j = 0; j < ((int)2); j++)
      for (int r = 0; r < ((int)k + 1); r++) dp[i][j][k] = 0;
  long long cnt = 0;
  for (int i = 0; i < ((int)n); i++) {
    if (s[i] != '0') cnt++;
    for (int j = 0; j < ((int)k + 1); j++) {
      if (cnt != j)
        dp[i][0][j] = 0;
      else
        dp[i][0][j] = 1;
    }
    if (i == 0) {
      dp[i][1][0] = 1;
      dp[i][1][1] = (s[i] - '0') - 1;
    } else {
      dp[i][1][0] = 1;
      for (int j = 1; j < ((int)k + 1); j++) {
        dp[i][1][j] = dp[i - 1][1][j - 1] * 9 + dp[i - 1][1][j] * 1 +
                      dp[i - 1][0][j - 1] * (s[i] - '0' - 1) +
                      dp[i - 1][0][j] * min(s[i] - '0', 1);
      }
    }
  }
  for (int i = 0; i < ((int)n); i++) {
    for (int r = 0; r < ((int)k + 1); r++) cout << dp[i][1][r] << " ";
    cout << endl;
  }
  cout << dp[n - 1][0][k] + dp[n - 1][1][k] << endl;
}
