#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e6;
const long long mod = 1e9 + 7;
const long double PI = 4 * atan((long double)1);
long long pw(long long a, long long b) {
  return (!b ? 1
             : (b & 1 ? a * pw(a * a % mod, b / 2) % mod
                      : pw(a * a % mod, b / 2) % mod));
}
string n;
long long k;
long long fact(long long n, long long k) {
  return ((k == 0) ? 1 : n * fact(n - 1, k - 1));
}
long long ent(long long n, long long r) {
  if (n < r) {
    return (0);
  }
  return (fact(n, r) / fact(r, r));
}
long long solve(long long k, long long cur) {
  if (k == 0) {
    return (1);
  }
  if (cur == (long long)n.size()) {
    return (0);
  }
  long long ans = 0;
  for (long long i = 1; i < 10; i++) {
    if (n[cur] > '0' + i) {
      ans += (ent((long long)n.size() - cur - 1, k - 1) * pw(9, k));
    } else if (n[cur] == '0' + i) {
      ans += solve(k - 1, cur + 1);
    }
  }
  if (n[cur] == '0') {
    ans += solve(k, cur + 1);
    ans %= mod;
  } else {
    ans += (ent((long long)n.size() - cur - 1, k) * pw(9, k));
  }
  return (ans);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  cout << solve(k, 0);
  return (0);
}
