#include <bits/stdc++.h>
using namespace std;
long long test[213456], aa[213456];
string uiop[213456];
signed main() {
  string n;
  long long k, a = 1, b = 1, c = 1, d = 1, e = 1, ans = 0;
  cin >> n >> k;
  long long keta = n.size();
  keta--;
  for (long long h = keta - k + 1; h <= keta; h++) {
    a *= h;
  }
  for (long long h = 1; h <= k; h++) {
    b *= h;
  }
  for (long long h = keta - k; h <= keta; h++) {
    d *= h;
  }
  for (long long h = 1; h <= k - 1; h++) {
    e *= h;
  }
  ans += pow(9, k) * a / b;
  keta++;
  if (k == 1) {
    ans += (n[0] - '0');
  }
  cout << ans << endl;
}
