#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 100100100100;
const long long MOD = 1000000007;
long long mod_pow(long long N, long long M) {
  if (M == 0) return 1;
  long long res = mod_pow((N * N) % MOD, M / 2);
  if (M & 1) res = (res * N) % MOD;
  return res %= MOD;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long dp[103][103][2];
int main() {
  string S;
  cin >> S;
  int K;
  cin >> K;
  int N = S.size();
  for (int i = 0; i < 103; i++)
    for (int j = 0; j < 103; j++)
      for (int k = 0; k < 2; k++) dp[i][j][k] = 0;
  for (int i = 1; i <= N; i++) {
    if (i == 1) {
      int firstDigit = S.at(i - 1) - '0';
      for (int j = 1; j < firstDigit; j++) {
        dp[1][1][0]++;
      }
      dp[1][1][1] = 1;
      dp[1][0][0] = 1;
      continue;
    }
    int nowDigit = S.at(i - 1) - '0';
    for (int j = 1; j <= i; j++) {
      if (nowDigit != 0) {
        dp[i][j][0] =
            dp[i - 1][j - 1][0] * 9 + dp[i - 1][j - 1][1] * (nowDigit - 1);
        dp[i][j - 1][0] = dp[i - 1][j - 1][0];
      } else {
        dp[i][j - 1][0] = dp[i - 1][j - 1][0];
      }
    }
    dp[i][i][1] = 1;
  }
  for (int i = 1; i <= N; i++) {
    int out = 0;
    for (int j = 0; j <= K; j++) {
      out += dp[i][j][0];
    }
    out += 1;
    cout << out << endl;
  }
  cout << dp[N][K][0] + dp[N][K][1] << endl;
}
