#include<bits/stdc++.h>

using namespace std;

#define il inline
#define re register int
#define Rep(i, s, e) for (re i = s; i <= e; ++i)
#define Dep(i, s, e) for (re i - s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout);

il int read() {
	int x = 0; bool f = true; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = false; c = getchar();}
	while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
	return f ? x : -x;
}

char s[110];
int len, k;
long long f[110][4], arr[110][4], ans;

il ll Query(int pos, int res) {
	if (arr[pos][res]) return arr[pos][res];
	if (!res) return arr[pos][res] = 1;
	if (s[i] == '0') return arr[pos][res] = Query(pos + 1, res);
	return arr[pos][res] = (s[i] - '1') * Query(pos + 1, res - 1) + Qurey()
}

int main() {
	scanf("%s", s + 1);
	k = read(), len = strlen(s + 1);
	f[0][0] = 1;
	Rep(i, 1, len) {
		Rep(j, 1, k) {
			f[i][j] = f[i - 1][j] + f[i - 1][j - 1] * 9;
		}
	}
	return printf("%lld", f[len][k]) & 0;
}