#include <bits/stdc++.h>
using namespace std;
long long aa[200000], bb[200000], cc[2000000];
void t() {
  aa[0] = aa[1] = 1;
  bb[0] = bb[1] = 1;
  cc[1] = 1;
  for (long long i = 2; i < 200000; i++) {
    aa[i] = aa[i - 1] * i % 1000000007;
    cc[i] = 1000000007 - cc[1000000007 % i] * (1000000007 / i) % 1000000007;
    bb[i] = bb[i - 1] * cc[i] % 1000000007;
  }
}
long long calc(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return aa[n] * (bb[k] * bb[n - k] % 1000000007) % 1000000007;
}
long long solve(string s, long long k) {
  if (k == 0) return 1;
  if (s == "") return 0;
  long long num = 1;
  for (long long i = 0; i < k; i++) num *= 9;
  long long ans = 0;
  ans += calc(s.size() - 1, k) * num;
  ans += (long long)(s[0] - '0' - 1) * (calc(s.size() - 1, k - 1)) * (num / 9);
  ans += solve(s.substr(1), k - 1);
  return ans;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  t();
  string a;
  long long b;
  cin >> a >> b;
  cout << solve(a, b) << "\n";
  return 0;
}
