#include <bits/stdc++.h>
constexpr int kMod = 1000000007;
long long dp[101][2][4];
int main() {
  std::string N;
  std::cin >> N;
  int K;
  std::cin >> K;
  int length = N.length();
  for (int i = 0; i <= length; ++i) {
    for (int s = 0; s < 2; ++s) {
      for (int k = 0; k <= K; ++k) {
        dp[i][s][k] = 0;
      }
    }
  }
  dp[0][0][0] = 1;
  for (int i = 1; i <= length; ++i) {
    int v = N[i - 1] - '0';
    for (int k = 0; k <= K; ++k) {
      if (v == 0) {
        dp[i][0][k] += dp[i - 1][0][k];
        dp[i][1][k + 1] += 9 * dp[i - 1][1][k];
        dp[i][1][k] += dp[i - 1][1][k];
      } else {
        dp[i][0][k + 1] += dp[i - 1][0][k];
        dp[i][1][k + 1] += 9 * dp[i - 1][1][k] + (v - 1) * dp[i - 1][0][k];
        dp[i][1][k] += dp[i - 1][1][k] + dp[i - 1][0][k];
      }
      dp[i][0][k] %= kMod;
      dp[i][1][k] %= kMod;
      dp[i][0][k + 1] %= kMod;
      dp[i][1][k + 1] %= kMod;
    }
  }
  std::cout << (dp[length][0][K] + dp[length][1][K]) % kMod << std::endl;
}
