#include <bits/stdc++.h>
using namespace std;
unsigned long long combination(unsigned long long n, unsigned long long k) {
  unsigned long long ans = 1;
  for (int i = 0; i < k; ++i) {
    ans *= n - i;
  }
  for (int i = 0; i < k; ++i) {
    ans /= i + 1;
  }
  return ans;
}
int main() {
  string N;
  unsigned long long K;
  cin >> N >> K;
  unsigned long long len = N.size();
  unsigned long long ans = 0;
  unsigned long long cnt = 0;
  for (int i = 0; i < len; ++i) {
    if (N[i] != '0') {
      ++cnt;
    }
  }
  if (cnt >= K) {
    ans += 1;
  }
  unsigned long long l = 0;
  while (K > 0) {
    cout << K << " " << len << endl;
    cout << ans << endl;
    if (len < K) {
      break;
    }
    if (N[l] == '0') {
      ++l;
      --len;
      continue;
    }
    unsigned long long s = N[l] - '0' - 1;
    ans += combination(len - 1, K - 1) * s * pow(9, K - 1);
    cout << ans << endl;
    for (unsigned long long i = 1; i <= len - K; ++i) {
      ans += combination(len - i - 1, K - 1) * 9 * pow(9, K - 1);
    }
    cout << ans << endl;
    --K;
    ++l;
    --len;
  }
  cout << ans << endl;
  return 0;
}
