#include <bits/stdc++.h>
using namespace std;
unsigned GetDigit(long long num) { return log10(num) + 1; }
void calc_one(long long N) {
  int digit = GetDigit(N);
  long long ans = 9 * (digit - 1);
  long long num = pow(10, (digit - 1));
  long long i = num;
  while (i <= N) {
    cout << i << endl;
    ans++;
    i += num;
  }
  cout << ans << endl;
}
void calc_two(long long N) {
  int digit = GetDigit(N);
  int i = 2;
  long long ans;
  while (i < digit) {
    ans += pow(9, i);
    i++;
  }
  cout << ans << endl;
}
void calc_three(long long N) {
  if (N <= 100)
    cout << 0 << endl;
  else {
  }
  cout << 0 << endl;
}
int main() {
  long long N;
  int K;
  cin >> N >> K;
  if (K == 1) {
    calc_one(N);
  } else if (K == 2) {
    calc_two(N);
  } else {
    calc_three(N);
  }
}
