#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
const int MAX = 1000;

long long 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;
    }
}

// 二項係数計算
long long 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;
}

int main(){
    COMinit();
    string n;
    int k;
    cin >> n;
    cin >> k;
    int count = 0, i = 0, result = 0;
    int mul = 1;
    for(int i=0; i<k; i++) mul *= 9;
    while(count < k || i < n.length()){
        if(n[i] != '0'){
            result += (int)(n[i] - '1') * mul * COM(n.length - i, k-count-1);
            mul /= 9;
            result += mul * COM(n.length - i, k-count-1);

        }
        i++;
    }
    return 0;
}