#include <bits/stdc++.h>
using namespace std;
const long long int LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
struct mint {
  long long int x;
  mint() : x(0) {}
  mint(long long int x) : x((x % MOD + MOD) % MOD) {}
  mint& fix() {
    x = (x % MOD + MOD) % MOD;
    return *this;
  }
  mint operator-() const { return mint(0) - *this; }
  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^(int b) {
    mint res = 1;
    while (b > 0) {
      if (b & 1) {
        res = (res * (*this));
      }
      *this = (*this) * (*this);
      b >>= 1;
    }
    return res;
  }
  mint operator+(const mint& a) const { return mint(*this) += a; }
  mint operator-(const mint& a) const { return mint(*this) -= a; }
  mint operator*(const mint& a) const { return mint(*this) *= a; }
  bool operator<(const mint& a) const { return x < a.x; }
  bool operator==(const mint& a) const { return x == a.x; }
};
int main() {
  string N;
  cin >> N;
  int K;
  cin >> K;
  vector<mint> ok(K + 1, 0);
  ok[0] = 1;
  ok[1] = N[0] - '1';
  int yet = 1;
  for (int i = 1; i < (int)(N).size(); ++i) {
    int x = N[i] - '0';
    vector<mint> ok2(K + 1, 0);
    for (int ki = 0; ki < (K + 1); ++ki) {
      ok2[ki] += ok[ki];
    }
    for (int ki = 0; ki < (K); ++ki) {
      ok2[ki + 1] += ok[ki] * 9;
    }
    if (yet <= K && x > 0) {
      ok2[yet] += 1;
    }
    if (yet < K && x > 0) {
      ok2[yet + 1] += x - 1;
    }
    if (x > 0) {
      yet++;
    }
    ok = ok2;
  }
  int ans = ok[K].x;
  if (yet <= K) {
    ans++;
  }
  cout << ans << endl;
  return 0;
}
