#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
} comb(100005);
int getDigit(long long n) {
  int d = 0;
  while (n) {
    n /= 10;
    d++;
  }
  return d;
}
int main() {
  long long n;
  int k;
  cin >> n >> k;
  int keta = getDigit(n);
  vector<int> value(100);
  int d = 0;
  while (n) {
    value[d] = n % 10;
    n /= 10;
    d++;
  }
  long long ans = 0;
  for (int i = 1; i <= keta - 1; i++) {
    if (i < k) continue;
    mint c = comb(max(1, i - 1), k);
    ans += c.x * pow(9, k);
  }
  if (k == 1) {
    ans += value[0];
  } else if (k == 2) {
    for (int i = 1; i <= keta - 1; i++) {
      ans += value[i];
    }
  } else if (k == 3) {
    for (int i = 1; i <= keta - 1; i++) {
      for (int j = i + 1; j <= keta - 1; i++) {
        ans += value[i] * value[j];
      }
    }
  }
  cout << ans << endl;
  return 0;
}
