import sys
from math import factorial

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
K = ir()
length = 0
for i in range(1, 100):
    if 10 ** i > N:
        length = i
        break

c = factorial(length) // factorial(K) // factorial(lenght-K)
c_1 = factorial(length-1) // factorial(K-1) // factorial(lenght-K-1)
print(c)
answer = 0
top = int(str(N)[0])
answer = factorial(length-1) // factorial(K) // factorial(lenght-K-1) * 9 ** K # 一個前まで
answer += factorial(length) // factorial(K) // factorial(lenght-K) * (top-1) * 9 ** K # 一桁目がtopより小さい数
print(answer)