#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;
string s;
int n, k;
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; ++i) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
ll COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll calc(ll digit, ll keta, bool issmall) {
  if (digit == n) {
    if (keta == 0)
      return 1;
    else
      return 0;
  }
  if (keta == 0) return 1;
  if (issmall)
    return COM(n - digit, keta) * pow(9, keta);
  else {
    ll zero = calc(digit + 1, keta, true);
    ll reduce = calc(digit + 1, keta - 1, true) * (s[digit] - '1');
    ll stay = calc(digit + 1, keta - 1, false);
    return zero + reduce + stay;
  }
}
int main() {
  cin >> s >> k;
  n = s.size();
  COMinit();
  ll ans = calc(0, k, false);
  cout << ans << endl;
}
