from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under




N_s = input()
N_l = len(N_s)
N = int(N_s)
K_s = input()
K_l = len(K_s)
K = int(K_s)

s = 0

for i in range(K_l, N_l):
  s += 9**K * cmb(i-1,K-1)

#N制限
start = 10**(N_l)
end = N
c = int(end/(10**(N_l-1)))
if K == 1:
  s += c


print(s)