N=input()
K=input()
list=[]
#mist=[]
nist=[]
for i in range(int(N)):
    list.append(str(i+1))
import re
for i in range(int(N)):
#    mist.append('0')
    nist.append('A')
#    j=re.search('0',list[i])
#    if j!=None:
        #文字列.replace('変換元','変換後')
#        mist[i]=list[i].replace('0','A')
for i in range(int(N)):
    nist[i]=len(list[i])-list[i].count('0')
judge=0
for i in range(int(N)):
    if nist[i]==int(K):
        judge+=1
print(judge)
