su = 0
m = int(input())
numOfZeros = int(input())
for i in range(1,m +1):
  num = i
  currZeros = 0
  while(i<10):
  	if num % 10 == 0:
      currZeros += 1
    num /= 10
  if currZeros == numOfZeros:
    su += 1
print(su)
    