#include <bits/stdc++.h>
using namespace std;
int calcNumOfCombination(int n, int r) {
  int num = 1;
  for (int i = 1; i <= r; i++) {
    num = num * (n - i + 1) / i;
  }
  return num;
}
int dig(int N) {
  int s = 0;
  while (N != 0) {
    N /= 10;
    s += 1;
  }
  return s;
}
int main() {
  int N, K;
  cin >> N >> K;
  int num = 1;
  int ans = 0;
  for (int i = 0; i < K; i++) {
    num *= 9;
  }
  for (int i = K; i <= dig(N); i++) {
    ans += num * calcNumOfCombination(i, K - 1);
  }
  cout << ans << endl;
}
