<?php
fscanf(STDIN,"%d",$a);
fscanf(STDIN,"%d",$b);

$count=0;

foreach(range(1,$a) as $value){
  $val=str_replace(array("0"),"", $value);
  //echo $val."\n";
  $val_count=strlen($val);
  if($val_count==$b){
  $count+=1;
  }
}
   echo $count;
?>