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

$count=0;

for($i=1;$i<=$a;++$i){
  $val=str_replace(array("0"),"", $i);
  //echo $val;
  $val_count=strlen($val);
  if($val_count==$b){
  $count+=1;
  }
}
echo $count;

?>