#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
long long max3(long long x, long long y, long long z) {
  return max(max(x, y), z);
}
long long min3(long long x, long long y, long long z) {
  return min(min(x, y), z);
}
const long long N = 1e5 + 10, M = 2e5 + 10, M2 = 1e6 + 10, mod = 1e9 + 7,
                inf = 1e17 + 10;
const long long INF = 1e9 + 7;
void add(long long &a, long long b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long X[] = {0, 1, 0, -1};
long long Y[] = {-1, 0, 1, 0};
long long power(long long x, long long n) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % mod;
    x = ((x % mod) * (x % mod)) % mod;
    n = n / 2;
  }
  return result;
}
string n;
long long k;
long long sz;
long long x[105];
long long cache[105][5][2];
long long dp(long long idx, long long cnt, long long less) {
  if (cnt > k) return 0;
  if (idx == sz + 1) {
    return (cnt == k);
  }
  long long &ans = cache[idx][cnt][less];
  if (ans != -1) return ans;
  ans = 0;
  if (!less) {
    for (long long i = 0; i <= x[idx]; i++) {
      if (i != 0)
        ans += dp(idx + 1, cnt + 1, less | (i < x[idx]));
      else
        ans += dp(idx + 1, cnt, less | (i < x[idx]));
      ans %= mod;
    }
  } else {
    for (long long i = 0; i <= 9; i++) {
      if (i != 0)
        ans += dp(idx + 1, cnt + 1, less);
      else
        ans += dp(idx + 1, cnt, less);
      ans %= mod;
    }
  }
  return ans;
}
long long f(string &s) {
  sz = s.size();
  for (long long i = 0; i < sz; i++) x[i + 1] = s[i] - '0';
  memset(cache, -1, sizeof(cache));
  return dp(1, 0, 0);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cin >> k;
  long long res = f(n);
  cerr << "Line:" << 111 << " ";
  __f("f(n)", f(n));
  for (long long i = 1; i < sz + 1; i++) cout << x[i] << "\n";
  res %= mod;
  cout << res;
  return 0;
}
